题解 | #统计每个月兔子的总数#
统计每个月兔子的总数
https://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
import sys #1 2 3 4 5 6 7 8 9 10 11 12 #1 1 2 3 5 8 n = int(input()) dp = [1] * n for i in range(2, n): dp[i] = dp[i-1] + dp[i-2] print(dp[n-1])
统计每个月兔子的总数
https://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
import sys #1 2 3 4 5 6 7 8 9 10 11 12 #1 1 2 3 5 8 n = int(input()) dp = [1] * n for i in range(2, n): dp[i] = dp[i-1] + dp[i-2] print(dp[n-1])
相关推荐