Created
September 9, 2012 08:19
-
-
Save aomoriringo/3683301 to your computer and use it in GitHub Desktop.
Project Euler Problem 8 with hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Char | |
main = do | |
l <- getLine | |
let nums = map digitToInt l | |
putStrLn $ show $ maxNum nums | |
maxNum :: [Int] -> Int | |
maxNum [] = 0 | |
maxNum all@(x:xs) = max (product (take 5 all)) (maxNum xs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
入力するファイルには数字が入ってます。(改行はなくして保存してるのでちょっとずるしてます)