백준25305: 커트라인
문제
https://www.acmicpc.net/problem/25305
문제 풀이
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int k = sc.nextInt();
ArrayList<Integer> list = new ArrayList<>();
for (int i = 0; i < N; i++) {
list.add(sc.nextInt());
}
Collections.sort(list, (x, y) -> y - x);
System.out.println(list.get(k-1));
}
}
댓글남기기