-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ_18110.java
More file actions
35 lines (28 loc) · 984 Bytes
/
Copy pathBOJ_18110.java
File metadata and controls
35 lines (28 loc) · 984 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
29
30
31
32
33
34
35
// BOJ - 18110
// Problem Sheet - https://www.acmicpc.net/problem/18110
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] levels = new int[n];
for (int i=0 ; i<n ; i++) {
levels[i] = Integer.parseInt(br.readLine());
}
Arrays.sort(levels);
int excludeCount = getExcludeCount(n);
int levelSum = 0;
int contributorCount = 0;
for (int i=excludeCount ; i<n-excludeCount ; i++) {
levelSum += levels[i];
contributorCount++;
}
System.out.println((int) Math.round((double) levelSum / contributorCount));
br.close();
System.exit(0);
}
private static int getExcludeCount(int n) {
return (int) Math.round((double) n * 0.15);
}
}