Skip to content

Commit 3b6332d

Browse files
authored
[BOJ] 9095 1, 2, 3 더하기 (S3)
1 parent ee70578 commit 3b6332d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

김지호/8주차/260218.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# https://www.acmicpc.net/problem/9095
2+
# 1, 2, 3 더하기, 실버3
3+
4+
import sys
5+
sys.stdin = open('../../../input.txt', 'r')
6+
7+
def solve(n):
8+
if n == 1:
9+
return 1
10+
elif n == 2:
11+
return 2
12+
elif n == 3:
13+
return 4
14+
else:
15+
return solve(n - 1) + solve(n - 2) + solve(n - 3)
16+
17+
T = int(input().strip())
18+
for _ in range(T):
19+
N = int(input().strip())
20+
print(solve(N))

0 commit comments

Comments
 (0)