Who's in the Middle
http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=1§ionid=3&problemid=21
1 //author:pz 2 3 import java.io.BufferedInputStream; 4 import java.util.Arrays; 5 import java.util.Scanner; 6 7 public class Main { 8 public static void main(String[] args) { 9 Scanner in = new Scanner(new BufferedInputStream(System.in)); 10 while (in.hasNext()) { 11 int n = in.nextInt(); 12 int[] arr = new int[n]; 13 for (int i = 0; i < n; i++) { 14 arr[i] = in.nextInt(); 15 } 16 Arrays.sort(arr); 17 System.out.println(arr[arr.length / 2]); 18 } 19 } 20 }