boj - 2751 수 정렬하기2(자바)

SlowAnd·2023년 12월 29일
0
package boj;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


public class boj_2751 {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter w = new BufferedWriter(new OutputStreamWriter(System.out));

        int count = Integer.parseInt(r.readLine());
        List<Integer> read = new ArrayList<>();
        for(int i=0;i< count; i++){
            read.add(Integer.parseInt(r.readLine()));
        }

        Collections.sort(read);

        for(int e: read){
            w.write(e + "\n"); 
        }
        w.flush();
    }
}

0개의 댓글