题解 | 兔子的数量

兔子的数量

https://www.nowcoder.com/practice/8783056676de4396b0bf816a3561d62f

dict={1:2, 2:3}
n=int(input())
if n in dict.keys():
    print(dict[n])
else:
    for i in range(3,n+1):
        dict[i]=dict[i-1]+dict[i-2]
    print(dict[n])


全部评论

相关推荐

xtu大迫杰:偶遇校友,祝校友offer打牌
点赞 评论 收藏
分享
北枳的南橘:建议大家务必去和他沟通一下,像极了小学生对你侃侃而谈国际局势😂
找AI工作可以去哪些公司...
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务