Skip to content

Instantly share code, notes, and snippets.

@remibantos
Last active January 30, 2016 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remibantos/230f180b0d3431a1fc70 to your computer and use it in GitHub Desktop.
Save remibantos/230f180b0d3431a1fc70 to your computer and use it in GitHub Desktop.
codingame.com - Skynet
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