其实就是个数列:
月份=》兔子数
1=》1
2=》1
3=》2
4=》3
5=》5
6=》8
7=》13
8=》21
9=》34
...
def demo(month): if month==1 or month==2: return 1 return demo(month-1)+demo(month-2) import sys for line in sys.stdin: for i in line.split(): print(demo(int(i)))
其实就是个数列:
月份=》兔子数
1=》1
2=》1
3=》2
4=》3
5=》5
6=》8
7=》13
8=》21
9=》34
...
def demo(month): if month==1 or month==2: return 1 return demo(month-1)+demo(month-2) import sys for line in sys.stdin: for i in line.split(): print(demo(int(i)))