Skip to content

Commit 909996a

Browse files
author
hangyeol
committed
104차 1번 문제풀이
1 parent 64ec6e9 commit 909996a

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# P(1) = 1
2+
# P(2) = 1
3+
# P(3) = 1
4+
# P(4) = 2
5+
# P(5) = 2
6+
# P(6) = 3
7+
# P(7) = 4
8+
# P(8) = 5
9+
# P(9) = 7
10+
# P(10) = 9
11+
12+
13+
def main():
14+
T = int(input())
15+
16+
for _ in range(T):
17+
N = int(input())
18+
19+
if N <= 3:
20+
print(1)
21+
continue
22+
23+
P = [0 for _ in range(max(N, 5))]
24+
25+
P[0] = 1
26+
P[1] = 1
27+
P[2] = 1
28+
P[3] = 2
29+
P[4] = 2
30+
31+
for j in range(5, N):
32+
P[j] = P[j-1] + P[j-5]
33+
34+
35+
print(P[N-1])
36+
37+
38+
if __name__ == "__main__":
39+
main()

0 commit comments

Comments
 (0)