Skip to content

Instantly share code, notes, and snippets.

@vchatela
Created February 2, 2016 21:43
Show Gist options
  • Save vchatela/9a19e83d58c66d396343 to your computer and use it in GitHub Desktop.
Save vchatela/9a19e83d58c66d396343 to your computer and use it in GitHub Desktop.
Codingame : Skynet the Chasm Solution
import java.util.*;
import java.io.*;
import java.math.*;
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
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.
if(coordX == road - 1)
System.out.println("JUMP");
else if(coordX > road - 1)
System.out.println("SLOW");
else if(speed == gap + 1)
System.out.println("WAIT");
else if(speed > gap + 1)
System.out.println("SLOW");
else
System.out.println("SPEED");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment