We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 297bf4b commit 3f6a88fCopy full SHA for 3f6a88f
week4/BOJ_2075(N번째 큰 수).java
@@ -0,0 +1,22 @@
1
+import java.io.*;
2
+import java.util.*;
3
+
4
+public class Main {
5
6
+ public static void main(String[] args) throws IOException {
7
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
8
+ int N = Integer.parseInt(br.readLine());
9
+ PriorityQueue<Integer> q = new PriorityQueue<>((o1, o2) -> o2 - o1);
10
+ for(int i=0; i<N; i++) {
11
+ StringTokenizer st = new StringTokenizer(br.readLine());
12
+ for(int j=0; j<N; j++) {
13
+ int num = Integer.parseInt(st.nextToken());
14
+ q.offer(num);
15
+ }
16
17
+ for(int i=0; i<N-1; i++) {
18
+ q.poll();
19
20
+ System.out.println(q.peek());
21
22
+}
0 commit comments