UVa 10189

From Algorithmist
Jump to navigation Jump to search

10189 - Minesweeper[edit]

Summary[edit]

Given a board with mine locations figure out where the number of mines there should be in each box.

Explanation[edit]

This is mostly an implementation question. The most simple way to do this is to reset your matrix and just add to all adjacent cells if a mine is found and also tag whether or not a cell is a mine or not. Go through the matrix and output the number of mines in the cell if the cell is not a mine.

Input[edit]

4 4
*...
....
.*..
....
3 5
**...
.....
.*...
0 0

Output[edit]

Field #1:
*100
2210
1*10
1110

Field #2:
**100
33200
1*100

Solutions[edit]