728x90
https://www.acmicpc.net/problem/11726
# dp[i] = dp[i - 1] + dp[i - 2]
import sys
input = sys.stdin.readline
N = int(input())
dp = [0] * (N + 1)
if N >= 3:
dp[1] = 1
dp[2] = 2
for i in range(3, N + 1):
dp[i] = dp[i - 1] + dp[i - 2]
print(dp[N] % 10007)
else:
print(N)
728x90
'Study > Coding Test' 카테고리의 다른 글
[백준] 5430 - AC Python (0) | 2023.06.05 |
---|---|
[백준] 11727 - 2×n 타일링 2 Python (0) | 2023.06.05 |
[백준] 2579 - 계단 오르기 Python (0) | 2023.06.02 |
[백준] 1463 - 1로 만들기 Python (0) | 2023.06.02 |
[백준] 17070 - 파이프 옮기기1 Python (0) | 2023.05.23 |