ca044c956a
I forgot all about Haskell
12 lines
303 B
Haskell
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]
|