summaryrefslogtreecommitdiff
path: root/2019/1.hs
diff options
context:
space:
mode:
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))