测试数据包括多组,每组一行,为整数n(1≤n≤90)。
对应输出第n天有几只兔子(假设没有兔子死亡现象)。
1<br/>2
while True: try: a, res = int(input()), [1, 2] while len(res) < a: res.append(res[-1] + res[-2]) print(res[a - 1]) except: break
a, b = 1, 2 L = [] L.append(a) for x in range(90): a, b = b, a + b L.append(a) while (True): x = int(input()) print(L[x])
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题