https://www.acmicpc.net/problem/10844
# 2023.01.29
import sys
input = sys.stdin.readline
n = int(input()) # 자리수
dp=[[0]*(10) for _ in range(n+1)]
for j in range(1, 10):
dp[1][j]=1
for i in range(2, n+1):
for j in range(10):
if j==0:
dp[i][j]=dp[i-1][j+1]
elif j==9:
dp[i][j]=dp[i-1][j-1]
else:
dp[i][j]=dp[i-1][j-1]+dp[i-1][j+1]
print(sum(dp[n])%1000000000)
'Problem Solving > BOJ' 카테고리의 다른 글
[DP] python 2294 동전2 (0) | 2023.01.29 |
---|---|
[Recursion] 11057 오르막수 (0) | 2023.01.29 |
[DP] python 2293 동전1 (0) | 2023.01.28 |
[BFS] python 2573 빙산 (0) | 2023.01.28 |
[BFS] 9205 맥주 마시면서 걸어가기 (0) | 2023.01.27 |