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:你有病哪!现在都啥时候了!还卖代码!In Reply To:你有病哪!现在都啥时候了!还卖代码! Posted by:BAD_GUY at 2012-08-05 16:30:28 为了100ms,整整搞了我2个月呢! 骂别人有病,你有种也给我整个出来? 1秒的代码谁要,我白送好了 #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> char pn[100000][8]; int main () { int i, j, n, c; int none = 1; scanf ("%d", &n); for (i = 0; i < n; i++) { j = 0; while (j < 7) { if (!isalnum (c = getchar ())) continue; if (c == 'A' || c == 'B' || c == 'C') c = '2'; if (c == 'D' || c == 'E' || c == 'F') c = '3'; if (c == 'G' || c == 'H' || c == 'I') c = '4'; if (c == 'J' || c == 'K' || c == 'L') c = '5'; if (c == 'M' || c == 'N' || c == 'O') c = '6'; if (c == 'P' || c == 'R' || c == 'S') c = '7'; if (c == 'T' || c == 'U' || c == 'V') c = '8'; if (c == 'W' || c == 'X' || c == 'Y') c = '9'; pn[i][j++] = c; } pn[i][7] = '\0'; } qsort (pn, n, 8, (int (*) (const void *, const void *)) strcmp); j = 0; for (i = 1; i < n; i++) { if (strcmp (pn[i], pn[j]) != 0) { if (i - j > 1) { printf ( "%c%c%c-%s %d\n", pn[j][0], pn[j][1], pn[j][2], pn[j] + 3, i - j ); none = 0; } j = i; } } if (i - j > 1) { printf ( "%c%c%c-%s %d\n", pn[j][0], pn[j][1], pn[j][2], pn[j] + 3, i - j ); none = 0; } if (none) 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