题解 | #斐波那契数列#

斐波那契数列

https://www.nowcoder.com/practice/ee5d403c1172487f8c7915b3c3d924c6

# 不用递归 只需要两个变量即可
input = int(input())
first = 1
sec = 1
for i in range(3, input+1):
    first, sec  =sec, first + sec
print(sec)

#斐波那契数列#
全部评论

相关推荐

苍蓝星上艾露:这简历。。。可以试试我写的开源简历优化工具https://github.com/weicanie/prisma-ai
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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