Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class Player {
- public static void out(String val) {System.out.println(val);}
- public static int scan(Scanner in) {int i = in.nextInt();in.nextLine();return i;}
- public static void main(String args[]) {
- Scanner in = new Scanner(System.in);
- int R = scan(in); // the length of the road before the gap.
- int G = scan(in); // the length of the gap.
- int L = scan(in); // the length of the landing platform.
- int OK_SPEED = G+1;
- int JUMP_START = R-3;
- boolean jumped = false;
- // game loop
- while (true) {
- int S = scan(in); // the motorbike's speed.
- int X = scan(in); // the position on the road of the motorbike.
- if (X>JUMP_START)
- {
- if (!jumped)
- {
- out("JUMP");
- jumped = true;
- }
- else out("SLOW");
- }
- else
- if (S>OK_SPEED) out("SLOW");
- else if (S<OK_SPEED) out("SPEED");
- else out("WAIT");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment