import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.TreeMap; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader sc=new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out)); TreeMap<Integer,Integer>arr=new TreeMap<>(); int n=Integer.parseInt(sc.readLine()); for (int i = 0; i < n; i++) { int a=Integer.parseInt(sc.readLine()); if(arr.containsKey(a))arr.put(a, arr.get(a)+1); else arr.put(a, 1); } for (Integer k:arr.keySet()) { out.println(k+" "+arr.get(k)); } out.flush(); } }
0.0分
1 人评分
分糖果 (C++代码)浏览:858 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:569 |
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:574 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:629 |
奖学金 (C++代码)浏览:2005 |
简单的a+b (C语言代码)浏览:537 |
sizeof的大作用 (C语言代码)浏览:1449 |
图形输出 (C语言代码)浏览:1384 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:403 |
简单的a+b (C语言代码)浏览:462 |