Skip to content
本站總訪問量
本站訪客數 人次

c547. Bert 爬樓梯

python
import sys

MOD = 1000000007

dp = [1, 1] + [0] * 10000  # 起始條件

for i in range(2, 10001):
    dp[i] = (dp[i - 1] + dp[i - 2]) % MOD

for line in sys.stdin.read().splitlines():
    n = int(line)
    print(dp[n])

Contributors

The avatar of contributor named as lucashsu95 lucashsu95

Changelog