parent
4e58ab46eb
commit
ee975cb56a
|
@ -6,9 +6,9 @@ main = do
|
||||||
|
|
||||||
|
|
||||||
day11 :: [String] -> Int
|
day11 :: [String] -> Int
|
||||||
day11 xs = sum $ map ((subtract 2) . floor . (/ 3) . read) xs
|
day11 xs = sum $ map ((subtract 2) . (`div` 3) . read) xs
|
||||||
|
|
||||||
day12 :: [String] -> Int
|
day12 :: [String] -> Int
|
||||||
day12 xs = (sum $ map (f . read) xs) - (sum $ map read xs) where
|
day12 xs = (sum $ map (f . read) xs) - (sum $ map read xs) where
|
||||||
f x | x>0=x+f (((subtract 2) . floor . (/ 3) . fromIntegral) x)
|
f x | x>0=x+f (((subtract 2) . (`div` 3)) x)
|
||||||
| otherwise = 0
|
| otherwise = 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user