We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ee70578 commit 3b6332dCopy full SHA for 3b6332d
1 file changed
김지호/8주차/260218.py
@@ -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