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 |
新手求大神指点迷津、、过了很多数据、、还是WA T^T#include <iostream> #include <string> using namespace std; int o[10000000]; int trans(char x) { if (x<='9'&&x>='0') return(x-'0'); else if (x<='O') return((x-'A')/3+2); else { if (x=='P'||x=='R'||x=='S') return 7; if (x=='T'||x=='U'||x=='V') return 8; if (x=='W'||x=='X'||x=='Y') return 9; } } int main() { string s; int n,l,k=0; int num=0; cin>>n; for (int i=1;i<=n;++i) { cin>>s; l=s.length(); num=0; for (int j=0;j<=l-1;++j) if (s[j]!='-') num=num*10+trans(s[j]); ++o[num]; } int kk=0; for (int i=0;i<=10000000;++i) { if (o[i]>1) { kk=1;num=i;s=""; for (int j=0;j<=6;++j) { s=char(num%10+48)+s; num/=10; if (j==3) s='-'+s; } cout<<s; cout<<' '<<o[i]<<endl; } } if (!kk) cout<<"No duplicates."<<endl; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator