- 题解
POJ P1002 本地能过编译,也能过样例,POJ上CE
- 2023-8-24 21:47:05 @
#include<cstring>
#include<iostream>
#include<set>
#include<map>
using namespace std;
signed main(){
int n;
cin>>n;
set<string> ms;
map<string,int > mp;
for(int i=1;i<=n;i++){
string x="";
string s;
cin>>s;
for(char c:s){
if(c=='-')continue;
else if(c=='A'||c=='B'||c=='C')x+='2';
else if(c=='D'||c=='E'||c=='F')x+='3';
else if(c=='G'||c=='H'||c=='I')x+='4';
else if(c=='J'||c=='K'||c=='L')x+='5';
else if(c=='M'||c=='N'||c=='O')x+='6';
else if(c=='P'||c=='R'||c=='S')x+='7';
else if(c=='T'||c=='U'||c=='V')x+='8';
else if(c=='W'||c=='X'||c=='Y')x+='9';
else x+=c;
}
mp[x]++;
if(mp[x]>1){
ms.insert(x);
}
}
for(auto l:ms){
for(int i=0;i<3;i++)cout<<l[i];
cout<<"-";
for(int i=3;i<l.size();i++)cout<<l[i];
cout<<" "<<mp[l]<<"\n";
}
return 0;
}
0 条评论
目前还没有评论...