操作
Problem 2 » 履歴 » リビジョン 2
« 前 |
リビジョン 2/4
(差分)
| 次 »
Noppi, 2023/12/27 04:43
Problem 2¶
#!r6rs
#!chezscheme
(import (chezscheme))
(define answer-2
(let loop ([first 0] [second 1] [result 0])
(let ([next (+ first second)])
(cond
[(< 4000000 next) result]
[(even? next)
(loop second next (+ result next))]
[else (loop second next result)]))))
(printf "2: ~D~%" answer-2)
Noppi が2023/12/27に更新 · 2件の履歴