#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
int map[] = {2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9};
int t[100002];
int cmp(const void *a,const void *b)
{
return *(int *)a - *(int *)b;
}
int main()
{
int T,i,j,n,c,f;
char s[50];
scanf("%d",&T);
getchar();
f = c = 0;
while(T--) {
gets(s);
n = 0;
for(i = 0;s[i];i++) {
if(isdigit(s[i]))
n = n * 10 + s[i] - '0';
else if(isupper(s[i]))
n = n * 10 + map[s[i] - 'A'];
}
t[c++] = n;
}
qsort(t,c,sizeof(int),cmp);
t[c] = 10000000;
for(i = 0;i < c;i = j) {
j = i + 1;
while(t[i] == t[j])
j++;
if(j - i > 1)
f = 1,printf("%03d-%04d %d\n",t[i] / 10000,t[i] % 10000,j - i);
}
if(!f)
puts("No duplicates.");
return 0;
}
POJ 1002
最新推荐文章于 2024-11-09 13:08:09 发布