Skip to content

Commit 3f6a88f

Browse files
committedApr 29, 2024
BOJ_2075 : N번째 큰 수
1 parent 297bf4b commit 3f6a88f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
 

‎week4/BOJ_2075(N번째 큰 수).java

+22
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)
Please sign in to comment.