Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.
- * ---
- * Hint: You can use the debug stream to print initialTX and initialTY, if Thor seems not follow your orders.
- **/
- class Player
- {
- public static void main(String args[])
- {
- Scanner in = new Scanner(System.in);
- int lightX = in.nextInt(); // the X position of the light of power
- int lightY = in.nextInt(); // the Y position of the light of power
- int initialTX = in.nextInt(); // Thor's starting X position
- int initialTY = in.nextInt(); // Thor's starting Y position
- String dir = "";
- // game loop
- while (true)
- {
- int remainingTurns = in.nextInt(); // The remaining amount of turns Thor can move. Do not remove this line.
- int TX = initialTX;
- int TY = initialTY;
- int LX = lightX;
- int LY = lightY;
- if(TX < LX && TY < LY)
- dir = "SE";
- else if(TX < LX && TY > LY)
- dir = "NE";
- else if(TX < LX && TY == LY)
- dir = "E";
- else if(TX > LX && TY < LY)
- dir = "SW";
- else if(TX > LX && TY > LY)
- dir = "NW";
- else if(TX > LX && TY == LY)
- dir = "W";
- else if(TX == LX && TY > LY)
- dir = "N";
- else if(TX == LX && TY < LY)
- dir = "S";
- System.out.println(dir);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement