Pro.ID22125 TitleFunny Game Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22125 AC0 Submit0 Ratio- 时间&空间限制描述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 作者 |