import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
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[] arr = new int[n];
for(int i=0; i<n; i++) arr[i] = Integer.parseInt(br.readLine());
Arrays.sort(arr);
int exclude = (int) Math.round(n * 0.15);
double result = 0;
for(int i=exclude; i < n - exclude; i++) result += arr[i];
result = result / (n - exclude * 2);
System.out.println(Math.round(result));
}
}
BufferedReader가 아닌 Scanner로 값을 받으면 시간 초과가 뜬다...
Arrays.sort()때문인 줄 알고 우선순위 큐로 수정했었는데 그냥 BufferedReader만 써주면 되는 거였다! 하하
'Coding Test > 백준' 카테고리의 다른 글
[백준/자바] 1517 - 버블 소트 (0) | 2023.08.03 |
---|---|
[백준/자바] 11004 - K번째 수 (0) | 2023.08.03 |
[백준/자바] 11399 - ATM (0) | 2023.06.05 |
[백준/자바] 1427 - 소트인사이드 (0) | 2023.06.05 |
[백준/자바] 1377 - 버블 소트 (0) | 2023.06.05 |