Skip to content

Instantly share code, notes, and snippets.

@aomoriringo
Created September 9, 2012 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aomoriringo/3683301 to your computer and use it in GitHub Desktop.
Save aomoriringo/3683301 to your computer and use it in GitHub Desktop.
Project Euler Problem 8 with hs
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)
@aomoriringo
Copy link
Author

入力するファイルには数字が入ってます。(改行はなくして保存してるのでちょっとずるしてます)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment