BZOJ2456 mode

本来是多有趣的一道题啊

*Java has 2 more seconds and 512M more memory when running and judging.

被我用java糟蹋了……

import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
	public static void main(String[] arg){
		InputReader cin = new InputReader(System.in);
		PrintWriter cout=new PrintWriter(System.out);
		int n = cin.nextInt();
		
		int[] a = new int[n];
		
		for(int i=0;i<n;i++)
			a[i] = cin.nextInt();
		
		Arrays.sort(a);
		
		cout.println(a[n/2]);
		
		cout.flush();
		cout.close();		
	}
  private static class InputReader {

      public BufferedReader rea;
      public StringTokenizer tok;

      public InputReader(InputStream stream) {
          rea = new BufferedReader(new InputStreamReader(stream), 32768);
          tok = null;
      }

      public String next() {
          while (tok == null || !tok.hasMoreTokens()) {
              try {
                  tok = new StringTokenizer(rea.readLine());
              } catch (IOException e) {
                  throw new RuntimeException(e);
              }
          }
          return tok.nextToken();
      }

      public int nextInt() {
          return Integer.parseInt(next());
      }
  }	
}