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 |
超内存~~~~~~苦恼#include<iostream.h> #include<stdlib.h> #include<iomanip.h> #include<map> #include<string.h> using namespace std; map<int,int> res; map<int,int>::iterator miter; char m[100]; int ok=0; int main() { char temp[100]; m['1']='1'; m['A']=m['B']=m['C']=m['2']='2'; m['D']=m['E']=m['F']=m['3']='3'; m['G']=m['H']=m['I']=m['4']='4'; m['J']=m['K']=m['L']=m['5']='5'; m['M']=m['N']=m['O']=m['6']='6'; m['P']=m['R']=m['S']=m['7']='7'; m['T']=m['U']=m['V']=m['8']='8'; m['W']=m['X']=m['Y']=m['9']='9'; m['0']='0'; int i,cas,k,l,t; cin>>cas; for(i=0;i<cas;i++) { cin>>temp; l=0; for(k=0;k<7;k++) { while(temp[l]=='-') l++; temp[k]=m[temp[l]]; l++; } temp[7]='\0'; t=atoi(temp); res[t]++; } for(miter=res.begin();miter!=res.end();miter++){ if(miter->second<2) continue; cout<<setfill('0')<<setw(3)<<miter->first/10000<<'-'<<setw(4)<<miter->first%10000<<' '<<miter->second<<'\n'; ok=1; } if(ok==0) cout<<"No duplicates."<<'\n'; return 1; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator