AoC/2020/day01/day01.hs

12 lines
303 B
Haskell
Raw Normal View History

2020-12-01 06:26:32 +01:00
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]