Problem 164

http://projecteuler.net/index.php?section=problems&id=164

これは簡単。表を埋めるだけの簡単なお仕事。

import Data.Array
m = 20
f = listArray ((1,,),(m,9,9)).map g.range $ ((1,,),(m,9,9))
where g (1,a,b) = 10 - (a+b)
g (n+1,a,b) = sum[f!(n,b,c)| c <- [..9-(a+b)]]
main = print.sum$[f!(m-2,a,b)| a<-[1..9], b<-[..9]]
More Reading
Newer// Problem 163
Older// Problem 161