题解 | #统计每个月兔子的总数#
统计每个月兔子的总数
https://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
n = int(input()) dp = [0, 1] # dp[i] = dp[i-1] + dp[i-2] for i in range(2, n+1, 1): dp.append(dp[i-1] + dp[i-2]) print(dp[n])
统计每个月兔子的总数
https://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
n = int(input()) dp = [0, 1] # dp[i] = dp[i-1] + dp[i-2] for i in range(2, n+1, 1): dp.append(dp[i-1] + dp[i-2]) print(dp[n])
相关推荐