-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSolution.java
More file actions
39 lines (32 loc) · 1.05 KB
/
Solution.java
File metadata and controls
39 lines (32 loc) · 1.05 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
35
36
37
38
39
/*
* Author: Minho Kim (ISKU)
* Date: 2017.07.21
* E-mail: minho1a@hanmail.net
*
* https://github.com/ISKU/Algorithm
* https://www.codeground.org/
*/
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String... args) throws Exception {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));
int testCase = Integer.parseInt(input.readLine());
for (int tCase = 1; tCase <= testCase; tCase++) {
int[] score = new int[Integer.parseInt(input.readLine())];
for (int i = 0; i < score.length; i++)
score[i] = Integer.parseInt(input.readLine());
Arrays.sort(score);
int maxScore = 0;
for (int i = 0; i < score.length; i++)
maxScore = Math.max(maxScore, score[i] + score.length - i);
int answer = 0;
for (int i = 0; i < score.length; i++)
if (score[i] >= maxScore - score.length)
answer++;
output.write(String.format("Case #%d\n%d\n", tCase, answer));
}
output.close();
}
}