|
|
back to boardWA4 ...i don't understand! import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
Map<Integer, Integer> m = new TreeMap<Integer, Integer>();
in.nextToken(); int nv = 0; int count = (int)in.nval;
for(int i=0; i<count; i++) { in.nextToken(); nv = (int)in.nval; if(m.containsKey(nv)) m.put(nv,(int)(m.get(nv)+1)); else m.put(nv, 1); }
for(int i : m.keySet()) { out.print(m.get(i)); out.print(' '); out.print(i); out.print(' '); }
out.flush(); } } |
|
|