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 |
救命!!!快吐血了!总是runtime error 为什么呢?求高手帮忙~~~ #include <stdio.h> #include <string.h> char in[100000][16]; char out[100000][8]; int n,time[100000]; int change() { char c,o[8]; int i,j,k=0,l=0,outl=0,m; for(i=0;i<n;i++) { l=0; for(j=0;(c=in[i][j])!='\0';j++) { if(c>='0'&&c<='9') o[l++]=c; switch(c) { case 'A':case 'B':case 'C': o[l++]='2'; break; case 'D':case 'E':case 'F': o[l++]='3'; break; case 'G':case 'H':case 'I': o[l++]='4'; break; case 'J':case 'K':case 'L': o[l++]='5'; break; case 'M':case 'N':case 'O': o[l++]='6'; break; case 'P':case 'R':case 'S': o[l++]='7'; break; case 'T':case 'U':case 'V': o[l++]='8'; break; case 'W':case 'X':case 'Y': o[l++]='9'; break; } } o[l]='\0'; for(j=0;(m=strcmp(o,out[j]))>0&&j<outl;j++); if(strcmp(o,out[j])==0) time[j]++; else { for (k=outl;k>j;k--) { strcpy(out[k],out[k-1]); time[k]=time[k-1]; } time[j]=1; strcpy(out[j],o); outl++; } } return outl; } main() { int i,outl,f=0; scanf("%d",&n); for(i=0;i<n;i++) scanf("%s",in[i]); outl=change(); for(i=0;i<outl;i++) if(time[i]>1) { printf("%c%c%c-%c%c%c%c %d\n",out[i][0],out[i][1],out[i][2], out[i][3],out[i][4],out[i][5],out[i][6],time[i]); f=1; } if(f==0) printf("No duplicates.\n"); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator