/ OPS / 题库 /

Moving in Cube

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:

  1. Start line - A single line, "N", where 1 &lt= N &lt= 100;

  2. 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 &ltA,B,C&gt coordinates of your robot's starting position. The coordinate values will be integers separated by individual spaces.

The origin of the coordinate system is &lt0,0,0&gt. 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.

  1. Moving Order- A single line, a string (length&lt100) 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 &ltD,E,F&gt 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

#提示#

#来源#
小波

信息

ID
1436
难度
5
分类
category1 点击显示
标签
递交数
0
已通过
0
通过率
?
上传者