Skip to content

Instantly share code, notes, and snippets.

@jen6
Created April 9, 2017 16:47
Show Gist options
  • Save jen6/9dcc8ef13c82d421f3c52598bdb781c9 to your computer and use it in GitHub Desktop.
Save jen6/9dcc8ef13c82d421f3c52598bdb781c9 to your computer and use it in GitHub Desktop.
readInts :: IO [Int]
readInts = fmap (take 3 . map read.words) getLine
camping n = do
(x:y:z:[]) <- readInts
if not $ z == 0
then
do
let day = ((z `div` y) * x + (z `mod` y))
putStrLn $ "Case " ++ (show n) ++ ": " ++ (show day)
camping $ n+1
else
putStrLn " "
main =
camping 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment