-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp1204.java
46 lines (36 loc) · 1.19 KB
/
p1204.java
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
41
42
43
44
45
46
package self.samsungExpert;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
// platform | SW Expert Academy
// number | 1204
// title | 1일차 - 최빈수 구하기
// level | D2
// how |
// etc |
// result |
public class p1204 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
StringTokenizer st;
int[] scores;
for(int test_case = 1; test_case <= T; test_case++) {
scores = new int[101];
int N = Integer.parseInt(br.readLine());
st = new StringTokenizer(br.readLine(), " ");
int maxScore = 0;
int cnt = 0;
while(st.hasMoreTokens()) {
int point = Integer.parseInt(st.nextToken());
scores[point] += 1;
if(cnt <= scores[point]) {
maxScore = point;
cnt = scores[point];
}
}
System.out.printf("#%d %d%n", N, maxScore);
}
}
}