编程介的小学生 2019-05-08 22:26 采纳率: 20.5%
浏览 127

Statement的正确性判断的矩阵程序,怎么利用C程序的语言的代码结构实现的呢?

Problem Description
The board is a rectangle of unit grids with N rows and M columns.
There are infinity 1×2 and 2×1 dominoes.
Some grids are broken, so they are removed, marked with 'X' character.
It is pressure to place dominoes in the board as many as possible.
But sometimes there may be one grid unfilled no matter how you place them.
The board has only one special gird marked with '@'. This special grid can place domino, but should be empty when you finish placement.
It is a pity that the only empty grid is marked with '.' when you finish placement.
You have chance to move the dominoes.The domino can be moved when the short edge is adjacent to the blank grid. The domino will move horizontally or vertically one grid. You can move the domino as many times as you want. Now, the question is how many initial placement can be adjust
with movement to the final state which means every droppable grid except '@' grid, marked with '.', should be filled with domino, and the '@' grid empty.

Input
The first line of the input gives the number of test cases T; T test cases follow.
Each case begins with one line with two integers N and M : the number of rows and columns in the grid.
The N lines of M characters each follow; each character is '.', 'X' or '@', as described in the statement.

Limits
T≤100
1≤N,M≤8
Each character in the grid is one of '.', 'X' or '@'.
'@' will appear exactly once;

Output
For each test case output one integer denotes the answer.
As for the answer may be too large, you should output it modulo 1000000007 (109+7).

Sample Input
3
3 5
....X
.@...
...X.
3 5
.....
.@...
.....
3 3
...
...
..@

Sample Output
4
10
16

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!
    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?