当前位置:网站首页>Force buckle - 1137 Nth teponacci number
Force buckle - 1137 Nth teponacci number
2022-04-23 11:47: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://yzsam.com/2022/04/202204231138314682.html
边栏推荐
- Simple construction of rebbitmq
- 解读机器人编程课程的生物认知度
- 第四章 为IM 启用填充对象之为IM列存储启用ADO(IM 4.8)
- Summary of the relationship among GPU, CUDA and cudnn
- Analyzing the role of social robots in basic science
- 论坛系统数据库设计
- The fourth chapter is about enabling and disabling the im column storage of table space for im enabled filling objects (IM 4.5)
- Summary of QT semaphore unresolved errors
- 云呐|如何管理好公司的固定资产,固定资产管理怎么做
- golang之筆試題&面試題01
猜你喜欢
解决由于找不到amd_ags_x64.dll,无法继续执行代码。重新安装程序可能会解决此问题,地平线(Forza Horizon 5)
Summary of the relationship among GPU, CUDA and cudnn
Nacos Foundation (7): Configuration Management
Analyze the rules for the use of robots with good performance
GPU, CUDA,cuDNN三者的关系总结
论坛系统数据库设计
力扣-1137.第N个泰波那契数
Tensorflow uses keras to create neural networks
解析社交性机器人对基础科学的作用
nacos基础(6):nacos配置管理模型
随机推荐
MySQL 的主从复制配置
How the database fills in IM expressions (IM 5.4)
Nacos Foundation (6): Nacos configuration management model
Simple construction of rebbitmq
VMware虚拟机使用esxi 导出硬盘vmdk文件
golang之筆試題&面試題01
Im architecture: CPU architecture: SIMD vector processing (im-2.3)
laravel-admin时间范围选择器dateRange默认值问题
Fabric 1.0源代码分析(33) Peer #peer channel命令及子命令实现
云呐|固定资产盘点中,支持多种盘点方式(资产清查盘点)
IMEU如何与IMCU相关联(IM 5.5)
激活函数之relu函数
解决由于找不到amd_ags_x64.dll,无法继续执行代码。重新安装程序可能会解决此问题,地平线(Forza Horizon 5)
Tensorflow使用keras创建神经网络的方法
少儿编程结构的改变之路
Chapter 4 is a tutorial on forced filling of in memory objects with IM enabled filling objects (IM 4.7)
第四章 为IM 启用填充对象之在NO INMEMORY表上指定INMEMORY列属性:示例(IM-4.4 第四部分)
Understanding of MQ
Database design of simple voting system
IFLYTEK's revenue in 2021 was 18.3 billion yuan: a year-on-year increase of 41% and a net profit of 1.556 billion yuan