`
to_zoe_yang
  • 浏览: 143258 次
  • 性别: Icon_minigender_2
  • 来自: 01
社区版块
存档分类
最新评论

Problem2

 
阅读更多
问题描述
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, ...

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.


就是求出满足小于4000000,并且是偶数的Fibonacci数的和。

public long Count1(){
		long result = 0;
		int start1 = 1;
		int start2 = 1;
		int end = 4000000;
		
		int cur ;
		do{
			cur = start1 + start2;
			if(cur%2==0){
				result += cur;
			}
			start1 = start2;
			start2 = cur;
		}while(start2<4000000);
		return result;
	}
分享到:
评论

相关推荐

    problem2.zip

    problem2.zip

    problem2.exe

    problem2.exe

    problem2.html

    problem2.html

    problem2.py

    problem2.py

    GM11.zip_A66_K._gm11模型代码_problem2pf_screen892

    灰色预测模型GM(1,1)的源代码,在command window窗口下键入命令 k=x; %(预测未来x年) X0=[ ]; %[ ]内输入初始数据 ...所得到的X为预测结果,error1为残差,error2为相对误差,c为该灰色模型的后验差比值

    绘制曲线.rar_EQ_EQ均衡器_eq曲线_problem2x8_全通滤波

    EQ均衡器曲线, SigmaStudio 各种滤波算法实现如全通,高通,低通,带通,EQ等等

    Here are a few algorithmic problems for you to try: Problem 1:

    Problem 2: Given a sorted array of integers, write a function to find the first duplicate in the array. Example: input = [1, 2, 3, 4, 5, 2, 3] -&gt; output = 2 Problem 3: Given a binary tree, write a...

    cs362-Problem2-LeapYear

    cs362 Problem2 LeapYear 适用于cs362第001节 规范:从作业1开始,使用测试优先方法重写the年计划。 如何运行文件:将文件上传到osu1 ENGR服务器到同一目录中。 之后,可以使用命令“ python3 tests.py”运行测试...

    Computer-Based.Problem.Solving.Process

    Title: Computer-Based Problem Solving Process Author: Teodor Rus Length: 350 pages Edition: 1 Language: English Publisher: World Scientific Publishing Company Publication Date: 2015-05-30 ISBN-10: ...

    Wicked Problem

    ### Wicked Problem与Wicked Environmental Problem #### 一、引言 "Wicked Problem"(棘手问题)这一概念最初由霍恩(Horst Rittel)和韦伯(Melvin Webber)于1973年提出,指的是那些复杂且难以解决的问题。这类...

    Problem Solving with C++, 10th Global Edition

    Problem Solving with C++, Global Edition by Walter Savitch (author) (Author) Pages:1117 出版社: Pearson Education Limited; 10th edition edition (November 20, 2017) Language: English ISBN-10: ...

    C语言middle.pdf

    本资源摘要信息涵盖了三个C语言中级问题的解决方案,分别是: Problem 1 三角形的个数、Problem 2 纯粹素数和Problem 3 纯粹合数。 Problem 1 三角形的个数 Problem 1 要求计算给定数字 n 的所有可能的三角形个数...

    problem

    标题 "problem" 提供的信息较少,但从描述中的 "NULL 博文链接:https://eric0000.iteye.com/blog/322311" 可以推测,这可能是一个关于解决某个问题或者技术讨论的博客文章链接。由于没有具体的博文内容,我们无法...

    node-problem-detector-0.8.7.tar

    node-problem-detector 镜像包 v0.8.7 版本

    a portfolio selection problem with type-2 fuzzy return.pdf

    a portfolio selection problem with type-2 fuzzy return.pdf a portfolio selection problem with type-2 fuzzy return.pdf a portfolio selection problem with type-2 fuzzy return.pdf

    MCM 2012 problem A B C 论文

    MCM 2012年 problem A problem B problem C 枪手论文

    Problem Arrangement zoj 3777

    Problem Arrangement zoj 3777

    MySQL数据库考试试题.docx

    2. 游标声明:DECLARE CURSOR 语句(Problem 2) 在 MySQL 中,DECLARE CURSOR 语句用于声明游标,以便在存储过程或函数中使用游标遍历结果集。 3. SELECT 语句的完整语法:SELECT,FROM,WHERE,GROUP BY,HAVING...

    Problem Solving with C++(9th) 无水印pdf

    Problem Solving with C++(9th) 英文无水印pdf 第9版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请...

    算法设计taxi problem

    算法设计里关于taxi problem的C语言代码

Global site tag (gtag.js) - Google Analytics