22125_FunnyGame

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

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

Pro.ID

22125

Title

Funny Game

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 3000/1000 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    Let me introduce an interesting game to you: in a 8x8 board, two players (suppose they’re Mr. Black and Mrs. White) alternately lay black and white stones respectively onto the units of that board. When one of them, suppose Mr. Black, puts a black stone onto the board, then we check the 8 directions of that stone, i. e. up, down, left, right, up left, up right, left down and right down. If there’s another black stone in one of the above direction and between the two black stones are all white stones, then those white stones are all "eaten" and replaced with black stones. As to the white stones, the rule is the same. Another rule is as follows: for any move of either player he must eat at least one stone of his opponent. When either of them cannot lay stone onto that board any more, the game ends. The winner is the one who has more stones on the board. If they have the same number of stones, it’s a draw game.

    For example, at first:


    Figure 1

    Then Mr. Black places a black stone at row 2 column 1, the board becomes:


    Figure 2

    Then Mrs. White places a white stone at row 3 column 3, the board becomes:

    Figure 3

    Now you are given the state of that board and who will move first, and suppose that both of them are clever enough to make the best choices, please find out who will win at last or whether it’s a draw game.

    输入

    For each case there’s an 8 x 8 board ( 'b' for black stone, 'w' for white stone, 'e' for empty unit) in the first 8 lines. And the following line is for the one who is to move first (Black or White). After all cases there’s a string of "EndOflnput" (without quotes). There’s no space in the input file.

    For each case in the input file there’re no more than 10 empty units at the initial state.

    输出

    Description

    Let me introduce an interesting game to you: in a 8x8 board, two players (suppose they’re Mr. Black and Mrs. White) alternately lay black and white stones respectively onto the units of that board. When one of them, suppose Mr. Black, puts a black stone onto the board, then we check the 8 directions of that stone, i. e. up, down, left, right, up left, up right, left down and right down. If there’s another black stone in one of the above direction and between the two black stones are all white stones, then those white stones are all "eaten" and replaced with black stones. As to the white stones, the rule is the same. Another rule is as follows: for any move of either player he must eat at least one stone of his opponent. When either of them cannot lay stone onto that board any more, the game ends. The winner is the one who has more stones on the board. If they have the same number of stones, it’s a draw game.

    For example, at first:


    Figure 1

    Then Mr. Black places a black stone at row 2 column 1, the board becomes:


    Figure 2

    Then Mrs. White places a white stone at row 3 column 3, the board becomes:

    Figure 3

    Now you are given the state of that board and who will move first, and suppose that both of them are clever enough to make the best choices, please find out who will win at last or whether it’s a draw game.

    Input

    For each case there’s an 8 x 8 board ( 'b' for black stone, 'w' for white stone, 'e' for empty unit) in the first 8 lines. And the following line is for the one who is to move first (Black or White). After all cases there’s a string of "EndOflnput" (without quotes). There’s no space in the input file.

    For each case in the input file there’re no more than 10 empty units at the initial state.

    Output
    For each case output one line containing the winner (Black or White) or “Draw” (without quotes) for draw game. Make sure that there are no redundant spaces in each line.
    Sample Input
    wwwwwwww
    wwwwwwww
    wwwwwwww
    wwwwwwww
    wwwwwwww
    wwwwwwww
    wwwwwwww
    wwwwwwwe
    Black
    wwwwwwww
    wwwwwwww
    wwwwwwww
    wwwwwwww
    bbbbbbbb
    bbbbbbbb
    bbbbbbbb
    bbbbbbbb
    White
    EndOfInput
    Sample Output
    White
    Draw
    Source

    样例输入

    wwwwwwww
    wwwwwwww
    wwwwwwww
    wwwwwwww
    wwwwwwww
    wwwwwwww
    wwwwwwww
    wwwwwwwe
    Black
    wwwwwwww
    wwwwwwww
    wwwwwwww
    wwwwwwww
    bbbbbbbb
    bbbbbbbb
    bbbbbbbb
    bbbbbbbb
    White
    EndOfInput

    样例输出

    White
    Draw

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部