▼页尾
摘要: A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.Find the largest palindrome made from the product of two 3-digit numbers.[代码]六位数的回文数为abccba;其中 abc 范围为 999~100;所以六位数的回文数只有900个。对于每一个回文数,我们看其能不能分解为两个三位数之积对于最小的六位回文数10000 阅读全文
posted @ 2011-02-20 22:31 xiatwhu 阅读(323) 评论(0) 推荐(0) 编辑
摘要: The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the number 600851475143 ?[代码]好啦,得到的结果是正确的但其实这个算法是错误的在验证一个数是否是素数时,我们一般是从2到sqrt()800000接近于600851475143的平方根但实际上求解600851475143的最大质因数不应该认为该质因数小于sqrt(600851475143)如15的最大质因数是5,但5不小于sqrt(15)所以,改到下面的算法[代码]该算法思路更清晰把因数从小到大一一分解出去 阅读全文
posted @ 2011-02-20 21:50 xiatwhu 阅读(588) 评论(0) 推荐(0) 编辑
摘要: 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-value 阅读全文
posted @ 2011-02-20 20:46 xiatwhu 阅读(203) 评论(0) 推荐(0) 编辑
摘要: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the multiples of 3 or 5 below 1000.[代码] 阅读全文
posted @ 2011-02-20 20:27 xiatwhu 阅读(265) 评论(0) 推荐(0) 编辑
摘要: DescriptionCalculate a+b InputTwo integer a,b;(-10^1000<=a,b<=10^1000) OutputOutput a+b Sample Input1 2 Sample Output3 [代码]大数加减法 阅读全文
posted @ 2011-02-20 20:03 xiatwhu 阅读(916) 评论(0) 推荐(0) 编辑
▲页首
西