BOJ_2075_N번째큰수

Bro_Jang·2025년 2월 3일

Algorithm

목록 보기
4/15
post-thumbnail

걸린 시간: 8m
알고리즘 분류: PQ

package BOJ_2075_N번째큰수;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
        int ans = 0;
        for(int i = 0 ; i < N * N; i++){
            int num = sc.nextInt();
            pq.add(num);
        }

        System.out.println(pq);

        for(int i = 0 ; i < N; i++){
            ans = pq.poll();
        }


        System.out.println(ans);
    }
}
profile
개발 해봐야지

0개의 댓글