From cb13d9733b7af2ee7662ffb428cf6e2a11df138a Mon Sep 17 00:00:00 2001 From: Akshay Date: Tue, 1 Dec 2020 19:17:47 +0530 Subject: ignore cabal stuff --- execs/Day01.hs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 execs/Day01.hs (limited to 'execs') 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 @@ +module Main where + +import Control.Monad + +main :: IO () +main = do + n <- map read . lines <$> readFile "input/01" + print . head $ ans1 n + print . head $ ans2 n + +ans1 l = do + a <- l + b <- l + guard $ a + b == 2020 + return $ a * b + +ans2 l = do + a <- l + b <- l + c <- l + guard $ a + b + c == 2020 + return $ a * b * c -- cgit v1.2.3