Time Lapse :3hour 12min 23sec
7193.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| #include <stdio.h> int main(int argc, char** argv) { int test_case; int T, N; long answer; char c; setbuf(stdout, NULL); scanf("%d", &T); for (test_case = 1; test_case <= T; ++test_case) { scanf("%d",&N); getchar(); c='0'; switch (N) { case 2: while('0'<=c&&c<='9'){ c = getchar(); } printf("#%d 0\n",test_case); break; default: answer = 0; do{ answer += c-48; c = getchar(); }while('0'<=c&&c<='9'); printf("#%d %d\n",test_case,answer%(N-1)); break; } } return 0; }
|