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 |
why wa???????????why???#include <stdio.h> #include <string.h> typedef struct { char time[10]; int n; }clock; int main(void) { int n, zero, i; char test[10]; clock c[33] = {{"1:00", 13}, {"2:00", 14}, {"3:00", 15}, {"4:00", 16}, {"5:00", 17}, {"6:00", 18}, {"7:00", 19}, {"8:00", 20}, {"9:00", 21}, {"10:00", 22}, {"11:00", 23}, {"12:00", 24}, {"13:00", 1}, {"14:00", 2}, {"15:00", 3}, {"16:00", 4}, {"17:00", 5}, {"18:00", 6}, {"19:00", 7}, {"20:00", 8}, {"21:00", 9}, {"22:00", 10}, {"23:00", 11},{"00:00", 12}, {"01:00", 13},{"02:00", 14},{"03:00", 15}, {"04:00", 16},{"05:00", 17},{"06:00", 18}, {"07:00", 19},{"08:00", 20},{"09:00", 21}}; zero = 0; scanf("%d", &n); while (n--) { scanf("%s", test); for (i = 0; i < 33; i++) if (strcmp(test, c[i].time) == 0) { printf("%d\n", c[i].n); break; } if (i >= 33) printf("%d\n", zero); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator