-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3.7-Bingo.java
More file actions
40 lines (31 loc) · 944 Bytes
/
3.7-Bingo.java
File metadata and controls
40 lines (31 loc) · 944 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
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.util.ArrayList;
import java.util.Scanner;
public class Andrei {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
ArrayList<Integer> ns = new ArrayList<>();
for (int i = 0; i < n * n; i++) {
int t=sc.nextInt();
ns.add(t);
}
for (int i = 0; i < k; i++) {
int x =sc.nextInt();
for(int j=0;j<ns.size();j++){
if(ns.get(j).equals(x)){
ns.remove(ns.get(j));
}
}
}
int sum = 0;
if (ns.isEmpty()) {
System.out.println("BINGO!");
} else {
for (int i = 0; i < ns.size(); i++) {
sum += 1;
}
System.out.println(sum);
}
}
}