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????????测试了好一阵都对啊,为什么是WA! #include<iostream.h> #include<string.h> void main() { char p[10000][100]; int num; cin>>num; for(int i=0;i<num;i++) { cin>>p[i]; for(int j=0;p[i][j]!='\0';j++) { switch(p[i][j]) { case '0':p[i][j]='0';break; case '1':p[i][j]='1';break; case 'A':case 'B':case 'C':case '2':p[i][j]='2';break; case 'D':case 'E':case 'F':case '3':p[i][j]='3';break; case 'G':case 'H':case 'I':case '4':p[i][j]='4';break; case 'J':case 'K':case 'L':case '5':p[i][j]='5';break; case 'M':case 'N':case 'O':case '6':p[i][j]='6';break; case 'P':case 'R':case 'S':case '7':p[i][j]='7';break; case 'T':case 'U':case 'V':case '8':p[i][j]='8';break; case 'W':case 'X':case 'Y':case '9':p[i][j]='9';break; default: for(int k=j;p[i][k]!='\0';k++) p[i][k]=p[i][k+1]; j--; break; } } p[i][j]='\0'; } char temp[1][100]; for(int m=0;m<num-1;m++) for(int n=0;n<num-1-m;n++) if(strcmp(p[n],p[n+1])>0) { strcpy(temp[1],p[n]); strcpy(p[n],p[n+1]); strcpy(p[n+1],temp[1]); } int n1=0,n2=1,jishu=1,tongji=1; while(n2<num) { while(strcmp(p[n1],p[n2])==0) { jishu++; n2++; } if(jishu>1) { for(int ji=0;ji<3;ji++) cout<<p[n1][ji]; cout<<"-"; for(int ji2=3;ji2<=6;ji2++) cout<<p[n1][ji2]; cout<<" "<<jishu<<endl; } else n2++; n1=n2-1; tongji*=jishu; jishu=1; } if(tongji==1) 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