-- Problem 8 module Main (main) where import qualified List (tails) import qualified Char (digitToInt) main :: IO () main = do digits_str <- getContents print $ problem8 $ to_digits digits_str problem8 :: [Int] -> Int problem8 = maximum . map product . lists_5digits -- [[7,3,1,6,7], [3,1,6,7,1], [1,6,7,1,7], ..., [6,3,4,5,0]] lists_5digits :: [Int] -> [[Int]] lists_5digits = filter (\xs -> length xs == 5) . map (take 5) . List.tails to_digits :: String -> [Int] to_digits = map Char.digitToInt . concat . lines |
最新の20件2023-08-12
2022-12-28
2017-08-15
2014-01-31
2014-01-29
2013-06-04
2012-11-23
2010-08-01
2010-07-24
Tweet
|