14 lines
284 B
Haskell
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
|