AoC/2020/day01/day01.hs
shu ca044c956a Day 01
I forgot all about Haskell
2020-12-01 06:26:32 +01:00

12 lines
303 B
Haskell

main :: IO ()
main = do
input <- map read . lines <$> readFile "input"
print (day1a input)
print (day1b input)
day1a :: [Int] -> Int
day1a input = head [x * y | x<-input, y<-input, x+y==2020]
day1b :: [Int] -> Int
day1b input = head [x * y * z | x<-input, y<-input, z<-input, x+y+z==2020]