数字频率

Grade 0 Open Time Thursday, 21 February 2013, 11:02 pm
Discount 0.8 Time Discount Thursday, 28 February 2013, 11:02 pm
Allow late Yes Close Time Thursday, 28 February 2013, 11:02 pm
Input file freq.in Output file freq.out
输入文件(freq.in)中有n个1至30的数字,统计并输出其中每个数字出现的频率,并输出到输出文件(freq.out)中,注意数字和百分比之间由冒号隔开,百分比精确到小数点后一位。
【输入格式】
       输入文件(freq.in)有若干行组成,第一行为一个整数n1n300000;接下来有n行,每一行有一个大于等于1小于等于30的整数。
【输出格式】
       输出文件(freq.out)30行,分别为13030个数出现的频率。
【输入输出样例】
输入文件名:freq.in
 
5
1
20
8
26
20
 
输出文件名freq.out
1:20.0%
2:0.0%
3:0.0%
4:0.0%
5:0.0%
6:0.0%
7:0.0%
8:20.0%
9:0.0%
10:0.0%
11:0.0%
12:0.0%
13:0.0%
14:0.0%
15:0.0%
16:0.0%
17:0.0%
18:0.0%
19:0.0%
20:40.0%
21:0.0%
22:0.0%
23:0.0%
24:0.0%
25:0.0%
26:20.0%
27:0.0%
28:0.0%
29:0.0%
30:0.0%