repo.or.cz
/
srid.projecteuler.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
importing projecteuler into git
[srid.projecteuler.git]
/
15.scm
blob
8c3562a6c01fd40c42fd83a618f2eef52c8c7142
1
(require (planet "memoize.ss" ("dherman" "memoize.plt" 2 1)))
\r
2
\r
3
(define (number-of-routes n)
\r
4
(define/memo (find x y)
\r
5
(if (and (= x n) (= y n))
\r
6
1
\r
7
(+ (if (= x n) 0 (find (add1 x) y))
\r
8
(if (= y n) 0 (find x (add1 y))))))
\r
9
\r
10
(find 0 0))
\r
11
\r
12
(number-of-routes 20)