forked from gojung/AlgorithmStudy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava_1204.java
More file actions
34 lines (31 loc) · 1.17 KB
/
java_1204.java
File metadata and controls
34 lines (31 loc) · 1.17 KB
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
//SWEA 1204 ÃÖºó°ª ±¸Çϱâ
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.StringTokenizer;
public class java_1204 {
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new FileReader("test.txt"));
//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int T = Integer.parseInt(br.readLine());
for(int t = 1; t <= T; t++){
br.readLine();
sb.append("#").append(t);
int[] score = new int[101];
String s = br.readLine();
StringTokenizer st = new StringTokenizer(s, " ");
for(int i = 0; i < 1000; i++)
score[Integer.parseInt(st.nextToken())]++;
int max = score[0];
int max_i = 0;
for(int i = 1; i <= 100; i++){
if((max < score[i]) || (max == score[i] && max_i < i)){
max = score[i];
max_i = i;
}
}
sb.append(" ").append(max_i).append("\n");
}
System.out.print(sb);
}
}