728x90
https://www.acmicpc.net/problem/11727
import sys
input = sys.stdin.readline
N = int(input())
dp = [0] * 1001
dp[1] = 1
dp[2] = 3
if N >= 3:
for i in range(3, N + 1):
dp[i] = dp[i - 1] + dp[i - 2] * 2
print(dp[N] % 10007)
else:
print(dp[N])
728x90
'Study > Coding Test' 카테고리의 다른 글
[백준] 11053 - 가장 긴 증가하는 부분 수열 Python (0) | 2023.06.27 |
---|---|
[백준] 5430 - AC Python (0) | 2023.06.05 |
[백준] 11726 - 2×n 타일링 Python (0) | 2023.06.04 |
[백준] 2579 - 계단 오르기 Python (0) | 2023.06.02 |
[백준] 1463 - 1로 만들기 Python (0) | 2023.06.02 |