当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3167:Hot Spot

题目描述
Hot Spot is a single player game played on a 4 by 4 game board. The purpose of the game is to move a red robot from its current location on the board to the top left corner. The game board may also contain green and blue robots. Each square of the game board can be occupied by no more than one robot at any time.

A robot may move in one of two ways:
    1. If two robots are adjacent horizontally or vertically (but not diagonally), one of them may jump over the other to the immediately adjacent square, provided that square is empty. For example, if robot a is immediately to the left of robot b, robot a may jump to the square immediately to the right of robot b.

    2. If three robots are adjacent in a line (again not diagonally), one of them may jump over the other two, provided the destination square is empty. For example, if robot b is immediately to the right of robot a and robot c is immediately to the right of robot b, robot a may jump to the square immediately to the right of robot c.
Every jump only changes the positions of the existing robots; robots are never removed from or added to the game board.

A blue robot is never allowed to be adjacent horizontally or vertically to another blue robot or to the red robot.

Given the initial configuration of the game board, determine the minimum number of jumps required to move the red robot into the top left corner.
输入解释
The input specifies the initial position of the board using four lines, each containing four characters. Each character may be either R, indicating the red robot, B, indicating a blue robot, G, indicating a green robot, or a period (.), indicating an empty square.
输出解释
Output a single line containing a single integer, the minimum number of jumps required for the red robot to reach the top left square of the game board.
输入样例
.GR.
....
....
....
输出样例
1
来自杭电HDUOJ的附加信息
Recommend chenrui

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3167

最后修改于 2020-10-25T23:00:50+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 32768/32768K(Java/Others)