BackJoon Algorithm 수정렬하기 4 11931 (Java)

업데이트:
최대 1 분 소요

BackJoon Algorithm - Java

alt

문제

alt

풀이

import java.io.*;
import java.util.Arrays;
import java.util.Collections;

public class Back_11931 {
    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int N = Integer.parseInt(br.readLine());
        Integer arr[] = new Integer[N];
        for(int i = 0; i< N; i++){
            arr[i] = Integer.parseInt(br.readLine());
        }

        Arrays.sort(arr, Collections.reverseOrder());

        for (Integer integer : arr) {
            bw.write(integer+"\n");
        }
        br.close();
        bw.close();
    }
}

댓글남기기