백준2751: 수 정렬하기 2
문제
https://www.acmicpc.net/problem/2751
문제 풀이
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
int n = sc.nextInt();
ArrayList<Integer> list = new ArrayList<>();
for (int i = 0; i < n; i++) {
list.add(sc.nextInt());
}
Collections.sort(list);
for (int value : list) {
sb.append(value).append("\n");
}
System.out.println(sb);
}
}
댓글남기기