#include<iostream>
#include<iomanip>
#include<fstream>
#include<memory.h>
#include<stdio.h>
using namespace std;
int map(char ch)
{
switch(ch)
{
case 'A':
case 'B':
case 'C':
return 2;
case 'D':
case 'E':
case 'F':
return 3;
case 'G':
case 'H':
case 'I':
return 4;
case 'J':
case 'K':
case 'L':
return 5;
case 'M':
case 'N':
case 'O':
return 6;
case 'P':
case 'R':
case 'S':
return 7;
case 'T':
case 'U':
case 'V':
return 8;
case 'W':
case 'X':
case 'Y':
return 9;
}
}
const int NUM=10000000;
int main()
{
freopen("input.txt","r",stdin);
int N;
while(scanf("%d",&N)!=EOF)
{
char str[255];
int* rem=new int[NUM];
memset(rem,0,sizeof(int)*NUM);
for(int i=0;i<N;i++)
{
scanf("%s",&str);
int num=0;
for(int j=0;str[j]!='\0';j++)
{
if(str[j]>='0'&&str[j]<='9')
num=num*10+(str[j]-'0');
else if(str[j]!='Q'&&str[j]!='Z'&&
str[j]>='A'&&str[j]<='Z')
num=num*10+map(str[j]);
}
rem[num]++;
}
bool flag=true;//no duplicates
for(int i=0;i<NUM;i++)
{
if(rem[i]>=2)
{
cout<<setfill('0')<<setw(3)<<i/10000;
cout<<'-'<<setfill('0')<<setw(4)<<i%10000;
cout<<' '<<rem[i]<<endl;
flag=false;
}
}
if(flag)
printf("No duplicates.\n");
}
return 0;
}
poj1002
最新推荐文章于 2021-02-28 23:11:56 发布