summaryrefslogtreecommitdiff
path: root/2019/1.hs
blob: a3b86f1ea17641fb672be3b0e83b2d465a0dd5ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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))