-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path3273.java
More file actions
27 lines (22 loc) · 745 Bytes
/
3273.java
File metadata and controls
27 lines (22 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
public class j_3273 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] input = br.readLine().split(" ");
int x = Integer.parseInt(br.readLine());
HashSet<Integer> set = new HashSet<>();
int get = 0;
for (String num : input) {
int val = Integer.parseInt(num);
if (set.contains(x - val)) {
get++;
}
set.add(val);
}
System.out.println(get);
}
}