1. Problem
2. My Solution
import sys
n = int(sys.stdin.readline().rstrip())
dp = [[0]*10 for _ in range(101)]
dp[1] = [0,1,1,1,1,1,1,1,1,1]
for i in range(2,n+1):
for j in range(0,10):
if j == 0:
dp[i][j] = dp[i-1][j+1] % 1000000000
elif j == 9:
dp[i][j] = dp[i-1][j-1] % 1000000000
else:
dp[i][j] = (dp[i-1][j-1] + dp[i-1][j+1]) % 1000000000
print(sum(dp[n]) % 1000000000)
1. Problem
2. My Solution
import sys
n = int(sys.stdin.readline().rstrip())
dp = [0]*91
dp[1] = dp[2] = 1
for i in range(2,n+1):
dp[i] = dp[i-1] + dp[i-2]
print(dp[n])
import sys
n = int(sys.stdin.readline().rstrip())
dp = [[0,0] for _ in range(91)]
dp[1][1] = 1
for i in range(2,n+1):
dp[i][0] = dp[i-1][0] + dp[i-1][1]
dp[i][1] = dp[i-1][0]
print(sum(dp[n]))
4. Learned