自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

转载 SICP练习2.17

为什么 (R1*R2)/(R1 + R2) 与 1/(1/R1+1/R2)求得的值不同。(define (par1 r1 r2) (div-interval (mul-interval r1 r2) (add-interval r1 r2)))(define (par1 r1 r2) (let ((one (make-i...

2011-10-24 21:21:00 115

转载 不用递归解决汉诺塔问题

无聊的蛋疼。#!/usr/bin/env pythondef Hanoi(n): #递归解法 def han(A,B,C,n): if n==1: print n,A,"-->",C else: han(A,C,B,n-1) print n,A,"-->",C ...

2011-08-05 18:18:00 643

转载 [Project Euler]Problem 10

Problem:  The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.  Find the sum of all the primes below two million.问题:  小于10的所有素数的和为 17。求小与2,000,000的所有素数的和。方法:  筛法求素数。View Code def p...

2011-06-07 10:01:00 81

转载 随机生成【0-50】区间内的十个数,使其总和等于100

使用动态规划来求解问题使用10*101的数组,l[i][j]表示随机i个的数,总和为j的所有可能性的数目。那么l[i][j]=sum(l[i-1][k] for k in range(j-50,j+1) if k>=0)使用1 到 l[i][j]中的每一个数字表示一种方案,将 1到l[i][j] 分为 50个区间1 到 l[i][j-50] ,1+l[i][j...

2011-06-01 11:38:00 712

转载 [Project Euler]Problem 9

Problem 9:  A Pythagorean triplet is a set of three natural numbers,abc, for which,    a2+b2=c2  For example, 32+ 42= 9 + 16 = 25 = 52.  There exists exactly one Pythagorean triplet f...

2011-05-31 09:45:00 82

转载 [Project Euler]Problem 8

Problem 8:  Find the greatest product of five consecutive digits in the 1000-digit number.问题:  找出1000个数字中连续5个数乘积的最大值方法一:  由题意直接写代码:View Code from functools import reducefrom operator i...

2011-05-21 20:40:00 100

转载 [Project Euler]Problem 7

Problem7:  By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.  What is the 10001st prime number?问题7:  通过列出前六个素数:2,3,5,7,11,13,我们可以知道第6个素数为13。 ...

2011-05-11 15:42:00 111

转载 [Project Euler]Problem 6

Problem 6:  The sum of the squares of the first ten natural numbers is,    12+ 22+ ... + 102= 385  The square of the sum of the first ten natural numbers is,    (1 + 2 + ... + 10)2= 552= 302...

2011-05-06 17:14:00 73

转载 [Project Euler]Problem 5

Problem 5:  2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.  What is the smallest positive number that isevenly divisibleby all of the...

2011-05-04 12:33:00 66

转载 [Project Euler]Problem 4

problem 4:  A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 9199.  Find the largest palindrome made from the product...

2011-04-18 22:29:00 86

转载 [Project Euler]Problem 3

Problem 3:  The prime factors of 13195 are 5, 7, 13 and 29.  What is the largest prime factor of the number 600851475143 ?  13195的素因子为 5,7,13和29.  求600851475143的最大素因子.本题考的是分解因式. 用factor取 ...

2011-04-14 12:51:00 95

转载 [Project Euler]Problem 2

Problem 2:  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, ......

2011-04-07 17:45:00 68

转载 [Project Euler]Problem 1

前段时间大家的推荐找到了 Peoject Euler这个联系算法的网站,很有收获,和大家分享一下做题的经验。Problem 1: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 ...

2011-04-02 11:53:00 59

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除