摘要: 这是斐波那契数 中用迭实现的(define (fib n) (fib-iter 1 0 n))(define (fib-iter a b count) (if(= count 0) b (fib-iter (+ a b) a (- count 1))) )下面关于它的应用 换零钱方式的统计(define (count-change amount) (cc amount 5) )(define (cc amount kinds-of-coins) (cond((= amount 0) 1) ((or (< amount 0)(= kinds-of-coins 0)) 0) (else (+ 阅读全文
posted @ 2011-04-13 21:48 neve 阅读(244) 评论(0) 推荐(0) 编辑