[SWEA] 3408 세가지 합 구하기

Time Lapse :10min 9sec

3408.c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
int main(int argc, char** argv)
{
register int test_case;
int T;
long N;
setbuf(stdout, NULL);
scanf("%d", &T);
for (test_case = 1; test_case <= T; ++test_case){
scanf("%ld",&N);
printf("#%d %ld %ld %ld\n",test_case ,N*(N+1)>>1 ,N*N,(N+1)*N);
}
return 0; //정상종료시 반드시 0을 리턴해야 합니다.
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/08/04/PS/SWEA/3408/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.