-
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class Main { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int N = Integer.parseInt(br.readLine()); int[] ans = new int[10001]; for (int i = 0; i < N; i++) { // N ans[Integer.parseInt(br.readLine())]++; } for (int i = 0; i < ans.length; i++) { if (ans[i] != 0) { for (int j = 0; j < ans[i]; j++) { bw.write(Integer.toString(i) + "\n"); } } } br.close(); bw.close(); } }
- 계층정렬해야 하는거 생각 했는데 계속 시간초과 걸려서 못품
- print 말고 BufferedWriter로 출력해야함