#abc326f. F - Robot Rotation
F - Robot Rotation
Score : points
问题描述
一个机器人位于坐标平面的原点,其中正 轴指向右侧,正 轴指向上方。最初,机器人面向正 轴方向。
您将按照以下顺序执行从 的操作:
- 使机器人顺时针或逆时针旋转 度。然后,机器人按照它所面对的方向向前移动 个单位。
是否存在一种选择旋转方向的方式,使得在 次操作后,机器人能够到达坐标 ?
如果可能,请确定每次操作应选择顺时针还是逆时针方向。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
A robot is at the origin of a coordinate plane where the positive -axis points to the right and the positive -axis points upwards. Initially, the robot is facing the positive -direction.
You will perform the following operation for in this order.
- Rotate the robot degrees clockwise or counterclockwise. Then, the robot moves forward units in the direction it is facing.
Can the direction of rotation be chosen so that the robot will be at the coordinates after the operations?
If it is possible, determine which direction, clockwise or counterclockwise, should be chosen for each operation.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
If the robot cannot be at the coordinates after the operations, print No
.
If the robot can be at the coordinates after the operations, the first line should contain Yes
, and the second line should contain a string of length that satisfies the following condition.
Condition: consists of L
and R
, and the following choices can put the robot at the coordinates after the operations: in the -th operation, rotate the robot counterclockwise if the -th character of is L
, and rotate it clockwise if it is R
.
If there are multiple solutions, you may print any of them.
Sample Input 1
3 -2 4
3 2 1
Sample Output 1
Yes
LLR
Initially, the robot is at and facing the positive -direction. The following choices can put the robot at the coordinates after the operations.
- First operation: Rotate the robot degrees counterclockwise to face the positive -direction. The robot moves forward units in the direction it is facing, and moves to .
- Second operation: Rotate the robot degrees counterclockwise to face the negative -direction. The robot moves forward units in the direction it is facing, and moves to .
- Third operation: Rotate the robot degrees clockwise to face the positive -direction. The robot moves forward unit in the direction it is facing, and moves to .
Sample Input 2
1 0 0
1
Sample Output 2
No
Sample Input 3
4 0 0
1 1 1 1
Sample Output 3
Yes
LRRR
Outputs such as LLLL
and RRRR
are also accepted.
Sample Input 4
14 2543269 -1705099
3 14 159 2653 58979 323846 2643383 2795028 841971 69399 37510 58 20 9
Sample Output 4
Yes
LLLLLLLLLRLRRR
update @ 2024/3/10 01:50:08