编程介的小学生 2019-11-11 11:33 采纳率: 20.5%
浏览 111

Go and Oreo 围棋问题

描述
Asa likes Go and Oreo, and he wants to combine them.

One day when he was playing Go, he suddenly came out with an idea: he could try to construct as more Oreo Patterns as possible!
An Oreo Pattern is a horizontal or vertical pattern with a starting black piece, an ending black piece, and consecutive white pieces in between.

Please help him fill the board with pieces to achieve his goal, and tell him the number of solutions by the way.

输入
The first line is an integer , indicating the number of test cases.

For each test case:

The first line is the size of the Go board .

Then lines follows. Each line contains characters, indicating the Go board. Character '.', 'B' and 'W' indicate an empty position, a black piece and a white piece respectively.

The pieces do not necessarily follow the rules of Go.

输出
For each test case, output the maximum number of Oreo Patterns as well as the number of solutions separated by a white space in one line.

样例输入
2
4
BBBB
B..B
B..B
BBBB
6
B....W
.B..W.
..BW..
..WB..
.W..B.
W....B
样例输出
4 7
24 1

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥35 平滑拟合曲线该如何生成
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站