Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 331 Solved: 145
[Submit][Status]
Description
给出一些数字,统计出现最多的数字0~9的次数
Input
输入为多行(1~500000行),至EOF结束。每行包含一个数字k,0<=k<=200000
Output
输出出现次数最多的数字0~9的个数。
Sample Input
12
11
10
9
8
7
6
5
4
3
2
Sample Output
4
Append Code
[Submit][Status]
#include
#include
#include
intmain()
{
chara[500001];
intb[10]={0};
while(scanf("%s",a)!=EOF)
{
for(inti=0;i<strlen(a);i++)
b[a[i]-'0']++;
}
intmax=b[0];
for(inti=0;i<10;i++)
if(b[i]>max)
max=b[i];
printf("%d",max);
}