10 lines
251 B
Haskell
10 lines
251 B
Haskell
main :: IO ()
|
|
main = do
|
|
input <- map read . lines <$> readFile "input"
|
|
print $ day1 input
|
|
print $ day1 $ zipWith3 (\x y z->x+y+z) input (tail input) (tail $ tail input)
|
|
|
|
|
|
day1 :: [Int] -> Int
|
|
day1 a = sum $ map fromEnum $ zipWith (<) a (tail a)
|