Created
November 17, 2015 10:45
-
-
Save erdem/3ff0d992d80c19330368 to your computer and use it in GitHub Desktop.
CodinGame: Power of Thor
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
i = readline().split(' ').map(Number); | |
LX = i[0]; | |
LY = i[1]; | |
TX = i[2]; | |
TY = i[3]; | |
while (1) { | |
s = LX==TX && LY<TY && "N" || ""; | |
s += LX==TX && LY>TY && "S" || ""; | |
s += LY==TY && LX<TX && "W" || ""; | |
s += LY==TY && LX>TX && "E" || ""; | |
if (LX>TX && LY>TY){ | |
s="SE"; | |
TX++; | |
TY++; | |
} | |
if (LX<TX && LY>TY){ | |
s="SW"; | |
TX--; | |
TY++; | |
} | |
if (LX>TX && LY<TY){ | |
s="NW"; | |
TX--; | |
TY--; | |
} | |
if (LX<TX && LY<TY){ | |
s="NE"; | |
TX++; | |
TY--; | |
} | |
print(s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment