当前位置:网站首页>力扣-1137.第N个泰波那契数
力扣-1137.第N个泰波那契数
2022-04-23 11:38:00 【Node_Su】

class Solution(object):
def tribonacci(self, n):
"""
:type n: int
:rtype: int
"""
if n == 1 or n == 0:
return n
if n == 2:
return 1
dp_1 = 1
dp_2 = 1
dp_3 = 0
for i in range(3, n + 1):
res = dp_1 + dp_2 + dp_3
dp_3 = dp_2
dp_2 = dp_1
dp_1 = res
i = i + 1
return dp_1
if __name__ == '__main__':
n = 25
Sol = Solution()
res = Solution.tribonacci(Sol, n)
print(res)
版权声明
本文为[Node_Su]所创,转载请带上原文链接,感谢
https://blog.csdn.net/Node_Su/article/details/124360637
边栏推荐
- Compress the curl library into a sending string of utf8 and send it with curl library
- Résumé de la relation entre GPU, cuda et cudnn
- Nacos Basics (5): getting started with Nacos configuration
- QT 怎么把QWigdet变成QDialog
- PDMS soft lithography process
- MySQL 的主从复制配置
- PCB的注意事项
- Share two practical shell scripts
- 解析社交性机器人对基础科学的作用
- oh-my-lotto
猜你喜欢

解读机器人创造出来的艺术

Summary of the relationship among GPU, CUDA and cudnn

Analyze the rules for the use of robots with good performance
![Change exchange II - [leetcode]](/img/ad/33b13a004208d613c9a211fec9e5b1.png)
Change exchange II - [leetcode]

laravel编写Console脚本

MQ在laravel中简单使用

Practical data Lake iceberg lesson 30 MySQL - > iceberg, time zone problems of different clients

5个免费音频素材网站,建议收藏

qt5.8 64 位静态库中想使用sqlite但静态库没有编译支持库的方法

Exploring the equipment and teaching of robot education
随机推荐
rebbitMQ的简单搭建
kettle复制记录到结果和从结果获取记录使用
Laravel adds custom helper functions
C# F23.StringSimilarity库 字符串重复度、文本相似度、防抄袭
[web daily practice] eight color puzzle (float)
Significance of actively participating in middle school robot competition
Tensorflow common functions
Analyzing the role of social robots in basic science
一文详解头部位姿估计【收藏好文】
Practical data Lake iceberg lesson 30 MySQL - > iceberg, time zone problems of different clients
Analyze the rules for the use of robots with good performance
nacos基础(6):nacos配置管理模型
激活函数之阶跃函数
Database design of forum system
qt5. 8. You want to use SQLite in the 64 bit static library, but the static library has no method to compile the supporting library
oh-my-lotto
赛微微电科创板上市破发:跌幅达26% 公司市值44亿
RebbitMQ的初步了解
谁说抠图要会 PS?这个开源神器还能批量抠,效果拔群!
stylecloud ,wordcloud 库学习及使用例子