Time limit: 1 second Memory limit: 256 MB Kian is stuck in a room and can't see…
- User
Time limit: 1 second Memory limit: 256 MB Kian is stuck in a room and can't see anywhere. We know that the floor of this room is square n x n n×n square tiles are tiled. Also, each tile has a unique number and the numbering of the tiles is spiral. For example, the numbering of tiles in the following figure n
5 It shows n=5.
13 12 11 10 9 14 23 22 21 8 15 24 25 20 7 16 17 18 19 6 1 2 3 4 5 13 14 15 16 1
12 23 24 17 2
11 22 25 18 3
10 21 20 19 4
9 8 7 6 5
Kian knows that there is a candle inside this room and wants to reach it, but because the room is dark, he cannot see anywhere. He asks you to guide him how far he needs to move in each direction to reach the candle by taking the number of the tile Kian is standing on and the tile the candle is on.
input In the only input line, three numbers in order n n and s s and d d comes with a distance that is the length of the room, the number of the tile and the number of the tile on which the candle is located.
1 ≤ n ≤ 2000 1≤n≤2000 1 ≤ s ≠ d ≤ n 2 1≤s =d≤n 2
output In the first output line, a number and a character with a space will appear. The number that is printed is the value that the key should move in the horizontal direction, and if it should go to the left, the character will be equal to L, and if it should go to the right, the character will be equal to R. If the key should not be moved horizontally, this line is ignored.
In the second output line, a number and a character with a space appear. The number that is printed is the value that the key should be moved in the vertical direction, and if it should go up, the character will be equal to U, and if it should go down, the character will be equal to D. If the key should not be moved vertically, this line is ignored.
examples Sample entry 1 5 1 25 Plain text Sample output 1 2 R 2 Plain text Sample entry 2 5 3 22 Plain text Sample output 2 3 Plain text Sample entry 3 15 67 24 Plain text Sample output 3 3 R 8 write in c++
- Assistant