|
|
back to boardWhy WA#2?? I make convert the university name into uppercase fully! Posted by tester 6 Aug 2009 13:12 Please give me test! This is my program: #include <stdio.h> #include <string.h> int main () { freopen ("input.txt","r",stdin); freopen ("output.txt","w",stdout); int n,q; char str[203][38] = {}; char monitor[203][38] = {}; int count = 0; int len = 0; scanf ("%d", &n); scanf ("%d%d", &n, &q); gets(str[0]); for (int i = 0; i < n; i++) { gets(str[i]); strcat(monitor[i],str[i]); len = strlen(str[i]); for (int j = 0; j < len; j++) { if (str[i][j] == '#') break; if ((str[i][j] < 97) && (str[i][j] != ' ') && (str[i][j] != '.') && (str[i][j] != '-') && (str[i][j] != '&') && (str[i][j] != '\n')) str[i][j] += 32; } if (str[i][len - 2] == '#') str[i][len - 1] = '\0'; } for (int i = 0; i < n; i++) { if (count == q) { printf ("%s", monitor[i]); return 0; } if (strlen(str[i]) != 0) { count++; for (int j = i + 1; j < n; j++) if (strcmp(str[i],str[j]) == 0) str[j][0] = '\0'; } } return 0; } |
|
|