题解 | #统计每个月兔子的总数#
统计每个月兔子的总数
http://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
while True:
try:
n = int(input())
def count(i):
if i == 1 or i ==2:
return 1
elif i>2:
#count(i) = count(i-1)+count(i-2)
return count(i-1)+count(i-2)
print(count(n))
except:
break
try:
n = int(input())
def count(i):
if i == 1 or i ==2:
return 1
elif i>2:
#count(i) = count(i-1)+count(i-2)
return count(i-1)+count(i-2)
print(count(n))
except:
break