22802_HotSpo

2022-5-16 18:22| 发布者: Hocassian| 查看: 24| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506969527700-Problem List-采集的数据-后羿采集器.html

Pro.ID

22802

Title

Hot Spot

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22802

AC

1

Submit

1

Ratio

100.00%

时间&空间限制

  • Time Limit: 8000/4000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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:

    • 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.

    • 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.

    输出

    Description

    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:

    • 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.

    • 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.

    Input

    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

    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.

    Sample Input

    .GR.
    ....
    ....
    ....

    Sample Output

    1

    Source

    样例输入

    .GR.
    ....
    ....
    ....

    样例输出

    1

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部