Last active
January 30, 2016 15:39
-
-
Save remibantos/230f180b0d3431a1fc70 to your computer and use it in GitHub Desktop.
codingame.com - Skynet
This file contains 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 java.util.Scanner; | |
class Player { | |
public static void main(String args[]) { | |
Scanner in = new Scanner(System.in); | |
int road = in.nextInt(); // the length of the road before the gap. | |
int gap = in.nextInt(); // the length of the gap. | |
int platform = in.nextInt(); // the length of the landing platform. | |
// game loop | |
while (true) { | |
int speed = in.nextInt(); // the motorbike's speed. | |
int coordX = in.nextInt(); // the position on the road of the motorbike. | |
System.err.println(coordX + ":" + (road - 1) + ":" + gap); | |
if (speed < gap + 1 && coordX < road) | |
System.out.println("SPEED"); // A single line containing one of 4 keywords: SPEED, SLOW, JUMP, WAIT. | |
else if (coordX == road - 1) | |
System.out.println("JUMP"); | |
else if (coordX > road - 1 + gap || speed > gap + 1) | |
System.out.println("SLOW"); | |
else | |
System.out.println("WAIT"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment