摘要: 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-val 阅读全文
posted @ 2011-02-28 23:08 能巴 阅读(189) 评论(0) 推荐(0)
摘要: 编程打印下列图形: A ABC ABCDE ABCDEFG ABCDEFGHI ABCDEFGHIJK ABCDEFGHIJKLM ABCDEFGHIJKLMNO ABCDEFGHIJKLMNOPQ ABCDEFGHIJKLMNOPQRS ABCDEFGHIJKLMNOPQ ABCDEFGHIJKLMNO ABCDEFGHIJKLM ABCDEFGHIJK ABCDEFGHI ABCDEFG ABCDE ABC A View Code #include<tchar.h>#include<string>#include<iostream>usingnamesp 阅读全文
posted @ 2011-02-28 22:18 能巴 阅读(257) 评论(0) 推荐(0)
摘要: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million.解题思路:看上去简单的透明。下面是我的瞬间实现:View Code 1#include<iostream>2usingnamespacestd;34boolisPrime(intval)5{6for(inti=2;i<val;i++)7{8if(val%i==0)9returnfalse;10}1112returntrue;13}1415int_tmain(intargc,_ 阅读全文
posted @ 2011-02-28 00:04 能巴 阅读(207) 评论(0) 推荐(0)