-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy path[07]_2.java
More file actions
28 lines (21 loc) · 798 Bytes
/
[07]_2.java
File metadata and controls
28 lines (21 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws Exception {
// 빠르게 입력 받기 위해 BufferedReader 라이브러리 사용
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int k = Integer.parseInt(st.nextToken());
ArrayList<Integer> data = new ArrayList<Integer>();
st = new StringTokenizer(br.readLine());
for (int i = 0; i < n; i++) {
data.add(Integer.parseInt(st.nextToken()));
}
Collections.sort(data);
System.out.println(data.get(k - 1));
}
}