Skip to content

Commit

Permalink
[BOJ] 9095(#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
heerucan committed May 5, 2022
1 parent cf467c2 commit 942b974
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions BOJ/9095.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 백준 9095 실버3
# 다이나믹 프로그래밍 : 1, 2, 3 더하기


t = int(input())
n = [int(input()) for i in range(t)]

dp = [0]*11

dp[1] = 1
dp[2] = 2
dp[3] = 4

for j in range(len(n)):
for i in range(4, n[j] + 1):
dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3]
print(dp[n[j]])

0 comments on commit 942b974

Please sign in to comment.