Redone day 7 with the Graphite graph library
[advent-of-code-20.git] / advent01 / src / advent01.hs
1 -- import Debug.Trace
2
3
4 main :: IO ()
5 main =
6 do numStrs <- readFile "data/advent01.txt"
7 let nums = map (read @Int) $ lines numStrs
8 print $ head $ part1 nums
9 print $ head $ part2 nums
10
11 part1 nums = [ x * y
12 | x <- nums
13 , y <- nums
14 , x < y
15 , x + y == 2020
16 ]
17
18 part2 nums = [ x * y * z
19 | x <- nums
20 , y <- nums
21 , z <- nums
22 , x < y
23 , y < z
24 , x + y + z == 2020
25 ]