aboutsummaryrefslogtreecommitdiff
path: root/execs
diff options
context:
space:
mode:
Diffstat (limited to 'execs')
-rw-r--r--execs/Day01.hs22
1 files changed, 22 insertions, 0 deletions
diff --git a/execs/Day01.hs b/execs/Day01.hs
new file mode 100644
index 0000000..4a10259
--- /dev/null
+++ b/execs/Day01.hs
@@ -0,0 +1,22 @@
1module Main where
2
3import Control.Monad
4
5main :: IO ()
6main = do
7 n <- map read . lines <$> readFile "input/01"
8 print . head $ ans1 n
9 print . head $ ans2 n
10
11ans1 l = do
12 a <- l
13 b <- l
14 guard $ a + b == 2020
15 return $ a * b
16
17ans2 l = do
18 a <- l
19 b <- l
20 c <- l
21 guard $ a + b + c == 2020
22 return $ a * b * c