Created
April 9, 2017 16:47
-
-
Save jen6/9dcc8ef13c82d421f3c52598bdb781c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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