Skip to content

Commit

Permalink
Solve first puzzle (in Haskell)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjpalmer committed Dec 2, 2019
1 parent b239ae4 commit c02b407
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions 2019/01/sumfuel.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
main = do
content <- readFile "sumfuel-input.txt"
let contentLines = lines content
let masses = map (read :: String -> Int) contentLines
let fuels = map (findFuel) masses
print (sum fuels)

findFuel mass = (div mass 3) - 2

0 comments on commit c02b407

Please sign in to comment.