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

建议使用的浏览器:

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

2699:Five in a Row

题目描述
The ACM Team of WHU is planning an online AI arena for Go-bang (Five in a Row). Now, we need some help.

We all know the famous game "Five in a Row". It is traditionally played with go pieces (black and white stones) on a go
board (15x15 intersections). The winner is the first player to get an unbroken row of five stones horizontally, vertically, or
diagonally.

We now have an uncompleted game, that is to say, yet no one won. You are required to tell us that whether the next player
could win within one step or not.
输入解释
The input consists of multiple test cases. The first line of input contains an integer T, which is the number of test cases.

Each test case is a 15 * 15 go board, 'B' represent for a black stone while 'W' for white ones. '.' represents cross with no
stone represented by 0.


[Technical Specification]
T is an integer, and T <= 20.
The number of white stones is either equal or 1 less than the number of black stones.
There is at least ONE '.' in each test case.
Test cases are separated by ONE empty line.
You can assume that black player goes first.
输出解释
For each test case, print a single line containing the result. If the next player could win within one step, display 'YES',
otherwise, display 'NO'.
输入样例
2 
........W...... 
..W......W...B. 
.W....B........ 
.W.......W..... 
..BB....W...... 
...B........... 
....B........WW 
...........B... 
....W.......... 
.W..B.B....WBB. 
BW........B.W.B 
............... 
W.....BB.W....W 
B..B.W.BB....B. 
........WW..... 

...B...W..BBW.. 
W..WBW..W...B.. 
...W..WBW...... 
.....BWW..B.B.. 
..BW.B.B..W.... 
B..W..WBW...... 
B......B......W 
B.B...B....W... 
....B.WB...B... 
B.W............ 
.....WW...B.... 
..B.....B...W.W 
.W.........WBW. 
B.............. 
..W.B...W..W..B 
输出样例
NO
YES
来自杭电HDUOJ的附加信息
Recommend yifenfei

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

源链接: HDU-2699

最后修改于 2020-10-25T22:56:02+00:00 由爬虫自动更新

共提交 0

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