AoC/2020/day01/day01.hs
2020-12-01 12:03:49 +01:00

14 lines
284 B
Haskell

import Control.Arrow
import Control.Monad
main :: IO ()
main = do
input <- map read . lines <$> readFile "input"
print $ day1 2 input
print $ day1 3 input
day1 :: Int -> [Int] -> Int
day1 =
fmap (snd . head . filter ((== 2020) . fst) . map (sum &&& product)) .
replicateM