Skip to content

Commit

Permalink
2024-4-29 1,2,3 더하기3
Browse files Browse the repository at this point in the history
  • Loading branch information
seongwon030 committed Apr 29, 2024
1 parent 6397334 commit a5c3f7e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions seongwon030/DP/1,2,3 더하기3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sys

input = sys.stdin.readline
dp = [1,2,4,7]
p = 4
for i in range(int(input())):
n = int(input())
while(n>p):
dp.append((dp[p-3]+dp[p-2]+dp[p-1])%1000000009)
p+=1
print(dp[n-1])

0 comments on commit a5c3f7e

Please sign in to comment.