5 lines
269 B
Haskell
5 lines
269 B
Haskell
main = readFile "1" >>= putStrLn . show . f . g . map (\x -> read x :: Integer) . lines
|
|
where f (x:_, y:_) | x + y == 2020 = x * y
|
|
f (x:xs, _:ys) = f (x:xs, ys)
|
|
f (_:xs, []) = f $ g xs
|
|
g (x:xs) = (x:xs, xs)
|