当前位置:网站首页>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
边栏推荐
- Tclerror: no display name and no $display environment variable
- tensorflow常用的函数
- 解析社交性机器人对基础科学的作用
- Precautions for PCB
- Nacos Foundation (7): Configuration Management
- MySQL 的主从复制配置
- Laravel admin time range selector daterange default value problem
- Golang Pen & interview 01
- IM表达式如何工作(5.3)
- 云呐|如何管理好公司的固定资产,固定资产管理怎么做
猜你喜欢

实践数据湖iceberg 第三十课 mysql->iceberg,不同客户端有时区问题

解读2022机器人教育产业分析报告

SOFA Weekly | 年度优秀 Committer 、本周 Contributor、本周 QA

Application of remote integrated monitoring system in power distribution room in 10kV prefabricated cabin project

微型机器人的认知和研发技术

解读机器人编程课程的生物认知度

Nacos Foundation (8): login management

激活函数之阶跃函数

MQ的了解

PSCP 基本使用
随机推荐
Usage record of map < qstring, bool >
TclError: no display name and no $DISPLAY environment variable
Analyze the rules for the use of robots with good performance
Yunna | how to manage the company's fixed assets and how to manage fixed assets
Laravel admin form validation
SOFA Weekly | 年度优秀 Committer 、本周 Contributor、本周 QA
kettle复制记录到结果和从结果获取记录使用
让中小学生在快乐中学习的创客教育
解析性能良好的机器人使用守则
第四章 为IM 启用填充对象之强制填充In-Memory对象:教程(IM 4.7)
docker MySQL主从备份
Change exchange II - [leetcode]
Sigmoid function of activation function
rebbitMQ的简单搭建
Nacos Foundation (8): login management
Yunna | fixed assets inventory supports multiple inventory methods (asset inventory)
Docker MySQL master-slave backup
Fabric 1.0源代码分析(33) Peer #peer channel命令及子命令实现
MQ的了解
微型机器人的认知和研发技术