Created
January 11, 2016 15:26
-
-
Save jkramer/08a7d19b6541a964a644 to your computer and use it in GitHub Desktop.
CodinGame - Chasm
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
import System.IO | |
import Control.Monad | |
main = do | |
hSetBuffering stdout NoBuffering -- DO NOT REMOVE | |
[road, gap, platform] <- replicateM 3 (fmap read getLine) | |
forever $ do | |
[speed, x] <- replicateM 2 (fmap read getLine) | |
putStrLn (command road gap platform speed x) | |
command road gap platform speed x | |
| x < road && speed < (gap + 1) = "SPEED" | |
| x < road && speed > (gap + 1) = "SLOW" | |
| x >= road = "SLOW" | |
| x + speed >= road = "JUMP" | |
| otherwise = "WAIT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment