古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子, 假如兔子都不死,问每个月的兔子总数为多少?

month=int(input('enter month:'))
a=1
b=1
if month<3:
print(1)
else:
for i in range(3,month):
a,b=b,a+b
print (a+b)
posted @ 2017-07-29 22:15  queqiaoshui  阅读(287)  评论(0编辑  收藏  举报