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 |
1002实在不知道错哪里了;;;;; #include <stdio.h> #include <string.h> #include <stdlib.h> char s[200001][100]; char ss[1000]; char s1[9]; int main() { int n, i, j = 0, k, flag = 0; scanf("%d", &n); while (n--) { i = 0; k = 0; fflush(stdin); scanf("%s", ss); while (ss[i]!='\0') { switch (ss[i]) { case '1': case '0': break; case '2': case 'A': case 'B': case 'C': ss[i] = '2'; break; case '3': case 'D': case 'E': case 'F': ss[i] = '3'; break; case '4': case 'G': case 'H': case 'I': ss[i] = '4'; break; case '5': case 'J': case 'K': case 'L': ss[i] = '5'; break; case '6': case 'M': case 'N': case 'O': ss[i] = '6'; break; case '7': case 'P': case 'R': case 'S': ss[i] = '7'; break; case '8': case 'T': case 'U': case 'V': ss[i] = '8'; break; case '9': case 'W': case 'X': case 'Y': ss[i] = '9'; break; default : break; } if(ss[i]>='0'&&ss[i]<='9') { if(k==3) { s[j][k++] = '-'; } s[j][k++] = ss[i]; } i++; } j++; } for(i=0; i<j-1; i++) { for(k=i+1; k<j; k++) { if(strcmp(s[i],s[k])>0) { strcpy(s1, s[k]); strcpy(s[k], s[i]); strcpy(s[i], s1); } } } k = 1; for(i=0; i<j; i++) { if(strcmp(s[i],s[i+1])==0) k++; else { if(k>1) { flag = 1; printf("%s %d\n", s[i], k); k = 1; } } } if(flag==0) printf("No duplicates.\n"); return 0; } 求路过的大牛给指点 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator