-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy path[05]_3.java
More file actions
31 lines (23 loc) · 781 Bytes
/
[05]_3.java
File metadata and controls
31 lines (23 loc) · 781 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
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
// 빠르게 입력을 받기 위해 BufferedReader 라이브러리 사용
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] data = new int[10001];
for (int i = 0; i < n; i++) {
data[Integer.parseInt(br.readLine())]++;
}
// 한 번에 빠르게 출력하기 위해 StringBuilder 라이브러리 사용
StringBuilder result = new StringBuilder();
for (int i = 0; i < 10001; i++) {
if (data[i] != 0) {
for (int j = 0; j < data[i]; j++) {
result.append(i).append("\n");
}
}
}
System.out.print(result);
}
}