题解 | #蛇形矩阵#
统计每个月兔子的总数
http://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
M=int(input())
a1,a2=1,1
if M<3:
print(1)
else:
for _ in range(M-2):##滑窗更新
tmp=a2
a2=a2+a1
a1=tmp
print(a2)
统计每个月兔子的总数
http://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
M=int(input())
a1,a2=1,1
if M<3:
print(1)
else:
for _ in range(M-2):##滑窗更新
tmp=a2
a2=a2+a1
a1=tmp
print(a2)
相关推荐