aboutsummaryrefslogtreecommitdiff
path: root/execs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-12-01 13:47:47 +0000
committerAkshay <[email protected]>2020-12-01 13:47:47 +0000
commitcb13d9733b7af2ee7662ffb428cf6e2a11df138a (patch)
tree2bc3936f28f21223b13ea7a08689ad1a8a0b89b4 /execs
parentcaf1e7203ccdbef4a1913e475f50f7a2a80e20d4 (diff)
ignore cabal stuff
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