PersonalCorpus 版 (精华区)
1228429 Big Guava ... 10062 Accepted
0:00.002 64 2002/11/11 02:36:25.938
int cmp(const void *a, const void *b)
{
int *a1=(int *)a, *a2=(int *)a+1;
int *b1=(int *)b, *b2=(int *)b+1;
if ((*b1<*a1)||((*b1==*a1)&&(*b2>*a2))) return 1; else return -1;
}
void main()
{
#ifndef ONLINE_JUDGE
freopen("k:\\uva\\i10062","r",stdin);
freopen("k:\\uva\\o10062","w",stdout);
#endif
int i,j,k,t=0;
char s[1010];
int c[96][2];
while (gets(s)) {
if (t) printf("\n"); else t++;
for (i=0;i<96;i++) { c[i][0]=0; c[i][1]=i+32; }
for (i=0;s[i];i++) if (s[i]>31) c[s[i]-32][0]++;
qsort(c,96,8,cmp);
for (i=0;i<96;i++) if (c[i][0]) break;
for (j=i;j<96;j++) printf("%d %d\n",c[j][1],c[j][0]);
}
}
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.073毫秒