Giáo trình Mine Sweeper Ioicamp

Giáo trình Mine Sweeper Ioicamp.Description
Given the locations of a set of mines, give the amount of mines adjacent to each non-mine square in
a grid.
Input
 Two integers W and H, representing the width and height of the mined area. (1 <= W, H <=
100)
 H lines of W characters, a ‘-‘ represents no mine and a ‘x’ represents a mine.
Output
 The grid of numbers indicating the number of mines adjacent to each non-mine square.
Leave an asterisk on each square where there is a mine.
Example
Input
10 8
—–x—-
-x——–
———-
—-xxx—
——x—
-x——–
——–xx
-x——xOutput
11101×1000
1×10111000
1111232100
0001xxx200
111124×200
1×10011222
22200002xx
1x100002x3

Giáo trình Mine Sweeper Ioicamp
Giáo trình Mine Sweeper Ioicamp
Bài viết liên quan
0989283268