操作
Problem 15¶
Lattice Paths¶
Starting in the top left corner of a $2 \times 2$ grid, and only being able to move to the right and down, there are exactly $6$ routes to the bottom right corner.
How many such routes are there through a $20 \times 20$ grid?
格子経路¶
2×2 のマス目の左上からスタートした場合, 引き返しなしで右下にいくルートは 6 つある.
では, 20×20 のマス目ではいくつのルートがあるか.
#!r6rs
#!chezscheme
(import (chezscheme))
(define iota-40-20
(filter
(lambda (num)
(< 20 num))
(iota 41)))
(define iota-20-1
(cdr (iota 21)))
(define answer-15
(/ (apply * iota-40-20)
(apply * iota-20-1)))
(printf "15: ~D~%" answer-15)
Noppi が2023/12/30に更新 · 2件の履歴