Problem 2
来源:互联网 发布:手机怎样删除淘宝差评 编辑:程序博客网 时间:2024/05/05 00:15
# -*- coding = utf-8 -*-#!/usr/bin/python'''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 valuesdo not exceed four million, find the sum of the even-valued terms.'''def Fibonacci (): x = 1 y = 1 sum = 0 while (x < 4000000): if( x % 2 == 0): sum = sum + x x, y = y , x + y print "sum = %d" %(sum) if __name__ == '__main__': Fibonacci()
0 0
- Problem 2
- Problem 2
- problem 2
- Problem 2
- Problem 2
- Problem 2 of Fibonacci
- Project Euler - Problem 2
- Project Euler problem 2
- 2Sum Problem
- 2:A-B Problem
- 2 Egg Problem
- projecteuler---->problem:2
- Problem 2 ---- euler
- 2 sum problem
- USACO 1.1 Problem 2
- USACO 1.2 Problem 2
- Project Euler Problem 2
- a+b problem 2
- <!DOCTYPE> 标签的深度剖析以及使用选择
- 使用addChildViewController时出现的问题
- Java回调机制解析
- android之viewpager进度条跟随页面滑动
- linux上ln命令详细说明
- Problem 2
- 混合高斯模型的EM求解(Mixtures of Gaussians)及Python实现源码
- Java高并发编程——为IO密集型应用设计线程数与划分任务
- 批量清理.svn(文件和文件夹)
- AFN同步异步请求
- 进程、线程、生产者消费者问题
- eclipse 引入 没有.project文件的方法
- opencv+MFC显示图像
- iOS开发中@property的属性weak nonatomic strong readonly等介绍