|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||10||6||6||75.000%|
Minesweeper is a game played on a R x C rectangular board. Some of the cells contain mines, and others are empty. For each empty cell, calculate the number of its adjacent cells that contain mines. Two cells are adjacent if they share a common edge or point. This means that each cell has a maximum of 8 neighbors (up, down, left, right, four diagonals).
There will be multiple test cases. The first line of each test case will have two integers, R and C (1 ≤ R,C ≤ 100), indicating the number of rows and columns of the board. The next R lines each contain exactly C characters. Each character is either a '*' (asterisk) indicating a mine, or a '.' (period) indicating an empty cell. The last data set is followed by a line containing two 0's.
Print each board on R lines with C characters per line, and replace every '.' with the appropriate digit indicating the number of adjacent cells that contain mines. Leave the '*' cells intact. Do not print any whitespace between cells. Do not print any blank lines between answers.
3 2 .. .* .. 5 5 *.*.* ..*.. ***** ..... ..**. 0 0
11 1* 11 *3*3* 36*63 ***** 24553 01**1