백준 18110번(Java)

박은지·2025년 2월 19일

백준

목록 보기
34/89
post-thumbnail

import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int result = 0;
		int n = Integer.parseInt(br.readLine());
		int none = (int) Math.round(n * 0.15); // 제외할 것
		ArrayList<Integer> list = new ArrayList<>();
		
		for(int i=0; i<n; i++) {
			list.add(Integer.parseInt(br.readLine()));
		}
		
		Collections.sort(list);
		int size = n - (none * 2);
		
		for(int i=none; i<size+none; i++) {
			result += list.get(i);
		}
		
		result = (int) Math.round((double)result/size);
		System.out.println(result);
	}
}
profile
백엔드 개발자가 되고싶은 eunzi😊

0개의 댓글