| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Accepted#include<stdio.h>
#include<string.h>
#include<map>
using namespace std;
typedef char S[111];
map<int,int>M;
int main()
{
int n,l,i,t;
S num;
while(~scanf("%d",&n)){
M.clear();
while(n--)
{
scanf("%s",num);
l=strlen(num);
t=0;
for(i=0;i<l;++i)
switch(num[i])
{
case '-':continue;
case 'A':case 'B':case 'C':t=t*10+2;break;
case 'D':case 'E':case 'F':t=t*10+3;break;
case 'G':case 'H':case 'I':t=t*10+4;break;
case 'J':case 'K':case 'L':t=t*10+5;break;
case 'M':case 'N':case 'O':t=t*10+6;break;
case 'P':case 'R':case 'S':t=t*10+7;break;
case 'T':case 'U':case 'V':t=t*10+8;break;
case 'W':case 'X':case 'Y':t=t*10+9;break;
default:t=t*10+(num[i]-'0');
}
if(M.find(t) == M.end())M.insert(map<int,int>::value_type
(t,1));
else++M[t];
}
bool find=false;
for(map<int,int>::iterator it = M.begin() ; it != M.end(); ++ it)
{
if(it->second > 1)
{
find=true;
printf("%03d-%04d %d\n",it->first / 10000,it->first % 10000,it->second);
}
}
if(!find)puts("No duplicates.");}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator