9 lines
295 B
Haskell
9 lines
295 B
Haskell
import System.IO
|
|
|
|
main = print . snd . foldl step (Nothing, 0) . map (read :: String -> Int) . lines =<< readFile "../input/01"
|
|
|
|
step (Nothing, sum) n = (Just n, sum)
|
|
step ((Just last), sum) n = (Just n, sum +
|
|
(if n > last then 1 else 0))
|
|
step :: (Maybe Int, Int) -> Int -> (Maybe Int, Int)
|