链接:http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=2410&cid=1176
Mine Number
Time Limit: 1000MS Memory limit: 65536K
题目描述
Every one once played the game called Mine Sweeping, here I change the rule. You are given an n*m map, every element is a '*' representing a mine, or a '.' representing any other thing. If I ask you what's the total number of mines around (i, j), you should check (i, j)'s up, down, left, right and also itself (if overstep the boundary, ignore it), if that position is a '*', you should add one to the total number of (i, j), and here I call the number Mine Number. For example, if the map is "..**.. ", we can get the Mine Number as "012210" easily, but here is the question, if I give you the Mine Number, can you tell me the original map?
输入
The input consists of multiple test cases.
The first line contains a number T, representing the number of test cases.
Then T lines follow. For each case, the first line contains two numbers n and m (1<=n, m<=20).representing the lines and rows. Then following n lines, each line contain m numbers each number represents the Mine Number.
输出
For each case, please print the case number (beginning with 1) and the original map which you reverted. The data guarantee there is only one result.
示例输入
27 11100101001012122322122232354532323323555323233123532133321022201333100010001115 6001110013431014541013431001110
示例输出
Case 1:...........*..*.*..*.**.*****.*.**.*****.*.**..***..*.**...*...***...........Case 2:........***...***...***.......
输出结果有点看不清,还是到原网页去看一下比较清晰。
http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=2410&cid=1176