summaryrefslogtreecommitdiff
path: root/2019/1.hs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-12-01 09:42:09 +0100
committertomsmeding <tom.smeding@gmail.com>2019-12-01 09:42:09 +0100
commit35f82a2aed37c8daf523ac4c9fbf7112659e8dda (patch)
treebcd2db31962d357aca764b394f4d236a1a984b4b /2019/1.hs
parent89d19c68bdd29e06fad53d61f13df1124b98ea6a (diff)
Start 2019!
Diffstat (limited to '2019/1.hs')
-rw-r--r--2019/1.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/2019/1.hs b/2019/1.hs
new file mode 100644
index 0000000..a3b86f1
--- /dev/null
+++ b/2019/1.hs
@@ -0,0 +1,13 @@
+module Main where
+
+import Input
+
+
+main :: IO ()
+main = do
+ input <- map read <$> getInput 1 :: IO [Int]
+ print (sum [n `div` 3 - 2 | n <- input])
+
+ let compute f = let extra = f `div` 3 - 2
+ in if extra <= 0 then 0 else extra + compute extra
+ print (sum (map compute input))