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啊,我的程序跟那些个AC的好像是一样的啊!请高人指点一下!#include <iostream> #include<string> #include<algorithm> #include <vector> #include<iomanip> using namespace std; int main(){ string ma="22233344455566677778889999"; int round; cin>>round; vector<int> h(round); string tempPhone; for(int i=0;i<round;i++){ cin>>tempPhone; string temp=""; for(int j=0;j<tempPhone.size();j++) if(tempPhone[j]!='-'){ if(tempPhone[j]>='A' && tempPhone[j]<='Z') temp+=ma[tempPhone[j]-'A']; else temp+=tempPhone[j]; } h[i]=atoi(temp.c_str()); } sort(h.begin(),h.end()); bool flag=false; for(int i=0;i<round;i++){ int j=i+1; while(h[i]==h[j] && j<round)j++; if(j-i>1){ flag=true; cout<<setfill('0')<<setw(3)<<h[i]/10000<<'-' <<setfill('0')<<setw(4)<<h[i]%10000<<' '<<j-i<<endl; i=j; } } if(!flag) cout<<"No duplicates."<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator