E002
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
Find the sum of all the even-valued terms in the sequence which do not exceed four million.
找出不大于4,000,000的斐波那契数列中偶数值的总和。
def problem2():
a, b, c = 1, 2, 4*10**6
#掐头
if 0==a%2:
sum = 2*a
elif 0==b%2:
sum = 2*b
else:
sum = 0
while b<=c:
a, b = b, a+b
sum += b
#去尾
if 0!=b%2:
sum -= b
if 0!=a%2:
sum -= a
return sum/2
if __name__=='__main__':
print str(problem2())
分享到:
相关推荐
该项目是一款采用Java语言开发的国际象棋棋盘游戏,包含40个文件,其中包括15个Java源文件、13个PNG图像文件、4个中文文件、3个WAV音频文件、1个Git忽略文件、1个LICENSE许可文件和1个Markdown文件。
该项目是一款开源的志愿汇系统,采用Java核心技术实现,并融合了JavaScript, HTML, CSS等前端技术。系统源码包含3648个文件,其中SVG文件2164个,PNG文件640个,JavaScript文件333个,HTML文件140个,CSS文件136个,Java文件56个,SCSS文件42个,LESS文件26个,JPG文件17个,XML文件11个。此系统提供了一个简单的开源实现,便于用户学习和定制。
那些年,与你同分同位次的同学都去了哪里?全国各大学在辽宁2020-2024年各专业最低录取分数及录取位次数据,高考志愿必备参考数据
目前应用最广的梯控分析修改软件
和印尼植物相关的图像数据集 数据说明: 该数据集呈现在您面前的是部分印尼植物图像,包括五种类型的植物,这些植物使印度尼西亚的植物群多样化。 五个类别分别为:1.钛无花果2.爪哇花3.冷冻甘蓝(黑兰)5.拉夫莱西亚阿诺迪亚(巨型棕榈花) 该数据集共包含2158张相关的图像。
学生成绩管理系统 毕业设计 源码+数据库+论文(JAVA+SpringBoot+Vue.JS) 启动教程:https://www.bilibili.com/video/BV11ktveuE2d
汽车底盘运输线1_三维3D设计图纸.zip
液压弯管机_三维3D设计图纸.zip
该项目是一款基于Go语言的ruidingCheng框架设计源码,共计172个文件,其中包含137个Go源文件,以及若干个配置文件、文档和忽略文件。
该项目为黑龙江大学2022届毕业生学业论文“校园生活APP的设计与实现”的服务端源码,采用Kotlin作为主要开发语言,同时包含Java语言支持。项目文件共计77个,其中Kotlin文件36个,Java类文件14个,图片文件12个,Markdown文件2个,属性文件和SQL文件各2个,以及LICENSE、gitignore、JAR文件各1个。
EPLAN史上最全部件库,部件宏,EDZ格式,大小合适导入容易 部件包含图片宏,尺寸宏,有西门子全系列PLC,s7-1200 1500 300 400 200 三菱FX系列,数字模拟,特殊模块,三菱变频器,伺服,触摸屏,台达,施耐徳,正泰,欧姆龙,得力西,ABB等低压电器等等。 做电气元件布局很方便, 与实物1:1大小对应。 你想要的里面都有。 导入后一劳永逸。
全自动立式圆瓶贴标机_三维3D设计图纸.zip
那些年,与你同分同位次的同学都去了哪里?全国各大学在辽宁2020-2024年各专业最低录取分数及录取位次数据,高考志愿必备参考数据
那些年,与你同分同位次的同学都去了哪里?全国各大学在辽宁2020-2024年各专业最低录取分数及录取位次数据,高考志愿必备参考数据
那些年,与你同分同位次的同学都去了哪里?全国各大学在辽宁2020-2024年各专业最低录取分数及录取位次数据,高考志愿必备参考数据
内容概要:SEAL是一种新的层次化的模仿学习框架。它引入了一种利用预训练大型语言模型(LLMs)生成高层次计划并提供有意义的目标表示的方法,而不需要任务层级的先验知识。为了强化子目标表征,研究提出了一种双编码器架构,分别采用了带有监督机制的LLMs 子目标学习以及非监督的矢量量化(Vector Quantization)。另外,SEAL 还融合了过渡增强型低级别规划器来改进对长跨度任务中目标状态转换情况下的适应度,实验证明这种方法可以显著提升复杂任务下的性能表现。 适合人群:具有强化学习和层次化模仿学习基础的人群。 使用场景及目标:用于解决机器人操作任务,特别是在少量专家数据的情况下解决长时间序列、稀疏奖励的任务,同时保持较好的泛化能力和较强的鲁棒性。 使用限制与注意点:目前SEAL仅适用于完全可观测的状态,针对部分观测状态下效果还有待优化,存在一定的不稳定现象需要进一步提高。对于大规模真实场景中的应用还需考虑模型扩展性等问题。
圆管倒角机_三维3D设计图纸.zip
Surfing-Segment是一款基于ik-analyzer的高级文本分词工具,源码文件共计62个,其中Java源文件46个,词典文件8个,XML配置文件3个,其他还包括Git忽略文件、LICENSE、Markdown文件、属性文件和政策文件等。该工具显著提升了专业术语和复杂型号的分词准确性,并集成了自定义词典、动态识别型号、同义词功能以及Elasticsearch插件等特色功能,非常适合用于电商平台提升用户体验。
该项目为基于Python核心的Frappe框架设计源码,综合运用Python、JavaScript、HTML、CSS、Shell等多种编程语言,共计2005个文件,其中包含728个Python文件、467个JavaScript文件、221个JSON文件、174个HTML文件、98个Markdown文件、77个CSS文件、74个CSV文件、38个PNG图片文件、34个LESS文件、16个SVG文件。此项目结构清晰,适用于构建复杂的应用程序和系统。
那些年,与你同分同位次的同学都去了哪里?全国各大学在辽宁2020-2024年各专业最低录取分数及录取位次数据,高考志愿必备参考数据