1350 Moving in Cube
Description
I have an NNN-sized Cube with a robot in it. I gave a string of moving order to the robot, I want to know where the robot is finally.
Input
Input to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank lines separating data sets.
A single data set has 4 components:
- Start line - A single line, "N", where 1 coordinates of your robot's starting position. The coordinate values will be integers separated by individual spaces.
The origin of the coordinate system is . Therefore, each component of each coordinate vector will be an integer between 0 and N-1, inclusive.
The first coordinate in a set indicates the row. Top row = 0.
The second coordinate in a set indicates the column. Left column = 0.
The third coordinate in a set indicates the slice. First slice = 0.
The Starting Position will be in empty space.
- Moving Order- A single line, a string (length coordinates of your robot's final position.
Sample
Input
3
OOO
OOO
OOO
XXX
XXX
OOO
OOO
OOO
OOO
0 0 0
OODDRRRROOUUII
Output
0 2 2
Source: 小波
Comments