[SWEA] 7193 승현이의 수학공부

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; //정상종료시 반드시 0을 리턴해야 합니다.
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/08/04/PS/SWEA/7193/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.