[BOJ] 10448 유레카 이론

Time Lapse : None

10448.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdio.h>

int answer_func(int num,int depth,int cur)
{
int i;
int temp = 0;
int ret = 0;

if (depth == 0 && (num == cur))
return 1;
else if (depth == 0 && (num!=cur))
return 0;

for (i = 1; i <= 44; i++)
{
temp = temp + i;

ret = ret + answer_func(num, depth - 1, cur + temp);
}
if (ret >= 1)
return 1;
else
return 0;
}

int main(void)
{
int test_case;
int i;
int num;
int k1 = 1, k2 = 1, k3 = 2;

scanf("%d", &test_case);

for (i = 0; i < test_case; i++)
{
scanf("%d", &num);
printf("%d\n", answer_func(num,3,0));
}
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/07/23/PS/BOJ/10448/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.