We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 64ec6e9 commit 909996aCopy full SHA for 909996a
1 file changed
live10/test104/문제1/백한결.py
@@ -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