[SWEA] 8338 계산기

Time Lapse :NONE

8338.c

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
#include <stdio.h>
char c;
int answer;
int main(int argc, char** argv)
{
int test_case;
int T, r, k;
scanf("%d",&T);
getchar();
for(test_case = 1; test_case <= T; ++test_case){
//c = getchar();
//getchar();
answer = 0;
//r = c-48;
scanf("%d",&r);
for(int i=0;i<r;i++){
//c = getchar();
//getchar();
//k = c-48;
scanf("%d",&k);
answer = answer *k > answer + k ? answer * k : answer + k;
}
printf("#%d %d\n",test_case,answer);
}
return 0;
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/08/04/PS/SWEA/8338/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.