forked from ndb796/python-for-coding-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2.java
More file actions
19 lines (14 loc) · 452 Bytes
/
2.java
File metadata and controls
19 lines (14 loc) · 452 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
ArrayList<Integer> arrayList = new ArrayList<>();
for (int i = 0; i < n; i++) {
arrayList.add(sc.nextInt());
}
Collections.sort(arrayList);
// 중간값(median)을 출력
System.out.println(arrayList.get((n - 1) / 2));
}
}