Moving in Cube
#描述#
I have an N*N*N-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 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 <= N <= 100;
Slice list - A series of N slices. Each slice is an N*N matrix representing a horizontal slice through the asteroid field. Each position in the matrix will be one of two values:
'O' - (the letter "oh") Empty space;
'X' - (upper-case) An obstruction。
3.Starting Position - A single line, "A B C", denoting the <A,B,C> coordinates of your robot's starting position. The coordinate values will be integers separated by individual spaces.
The origin of the coordinate system is <0,0,0>. 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<100) formed by six kinds of letters: "UDLRIO", each means: 'U': move up if the robot could; 'D': move down if the robot could; 'L': move left if the robot could; 'R': move right if the robot could; 'I': move from the k-slice to k-1_slice if the robot could; 'O': move from the k-slice to k+1_slice if the robot could。
Tips: the robot would stop when it was ordered to move outside or to an obstruction.
##输出格式##
Output the finally position of the robot, "D E F", denoting the <D,E,F> coordinates of your robot's final position.
#样例1#
##样例输入1##
3
OOO
OOO
OOO
XXX
XXX
OOO
OOO
OOO
OOO
0 0 0
OODDRRRROOUUII
##样例输出1##
0 2 2
#限制#
1000ms
32768KB
#提示#
#来源#
小波