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 |
RE:前面几位给的用例全试过了,但是还是RE#include<stdio.h> #include<string.h> int main() { int n,i,j,k,m=0,count[100001],t,flag=0,b[100001],len; char phn[100001][100],s[100001][8],a[100001]; memset(count,0,sizeof(count)); scanf("%d",&n); for(i=0;i<n;i++) scanf("%s",phn[i]); for(i=0;i<n;i++) { len=strlen(phn[i]); o:for(j=0;j<len;j++) {if(phn[i][j]=='A'||phn[i][j]=='B'||phn[i][j]=='C') {phn[i][j]='2';continue;} if(phn[i][j]=='D'||phn[i][j]=='E'||phn[i][j]=='F') {phn[i][j]='3';continue;} if(phn[i][j]=='G'||phn[i][j]=='H'||phn[i][j]=='I') {phn[i][j]='4';continue;} if(phn[i][j]=='J'||phn[i][j]=='K'||phn[i][j]=='L') {phn[i][j]='5';continue;} if(phn[i][j]=='M'||phn[i][j]=='N'||phn[i][j]=='O') {phn[i][j]='6';continue;} if(phn[i][j]=='P'||phn[i][j]=='R'||phn[i][j]=='S') {phn[i][j]='7';continue;} if(phn[i][j]=='T'||phn[i][j]=='U'||phn[i][j]=='V') {phn[i][j]='8';continue;} if(phn[i][j]=='W'||phn[i][j]=='X'||phn[i][j]=='Y') {phn[i][j]='9';continue;} if(phn[i][j]=='-') { for(k=j;k<len;k++) phn[i][k]=phn[i][k+1]; goto o; } } phn[i][7]='\0'; } for(i=0;i<n-1;i++) {for(j=i+1;j<n;j++) {if(strcmp(phn[i],phn[j])==0&&strcmp(phn[i],"EOF")!=0) {count[i]++; strcpy(phn[j],"EOF"); } } } for(i=0;i<n-1;i++) {if(count[i]>0 ) {strcpy(s[m],phn[i]); b[m]=count[i]; m++; } } if(m>0){for(i=0;i<m-1;i++) for(j=0;j<m-1-i;j++) if(strcmp(s[j],s[j+1])>0) { strcpy(a,s[j]); strcpy(s[j],s[j+1]); strcpy(s[j+1],a); t=b[j]; b[j]=b[j+1]; b[j+1]=t; } for(i=0;i<m;i++) {for(j=0;j<3;j++) printf("%c",s[i][j]); printf("-"); for(j=3;j<7;j++) printf("%c",s[i][j]); printf(" %d\n",b[i]+1); } } if(m==0) printf("No duplicates.\n"); return 0; } 请哪位要是能看出来请帮帮我,这道题感觉不难,但是一直就卡在RE了。 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator