백준 풀이

백준 9095번 파이썬 (dp)

ag2개발자 2022. 8. 27. 14:09
t=int(input())
dp=[0]*11
dp[1]=1
dp[2]=2
dp[3]=4
for i in range(4,11):
    dp[i] = dp[i-1]+dp[i-2]+dp[i-3]

 

for _ in range(t):
    n=int(input())
    print(dp[n])
 
직접 구해봐서 점화식을 찾는다