Problem 112
http://projecteuler.net/index.php?section=problems&id=112
ナイーブな実装。遅くないので、よしとする。
map2 f xs = zipWith f xs $ tail xs descend, ascend :: Integer -> Bool descend = and.map2 (>=).show ascend = and.map2 (<=).show main = print.snd.head.filter f.scanl add (0,1) $ [1..] where f (n,d) = 100*n == d add (m,_) x | descend x || ascend x = (m+1,x) | otherwise = (m,x)