Problem A
http://icpc.logos.ic.i.u-tokyo.ac.jp/icpc2007/contest/A_ja.html
import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Scanner; public class A { Scanner sc = new Scanner(System.in); A(){ for(;;){ int n = sc.nextInt(); if(n == 0) break; List<Integer> list = new LinkedList<Integer>(); int sum = 0; int tmp = 0; for(int i = 0; i < n; i++){ tmp = sc.nextInt(); sum += tmp; list.add(tmp); } Collections.sort(list); System.out.println((sum-list.get(0)-list.get(list.size()-1))/(list.size()-2)); } } public static void main(String[] args) { new A(); } }