UVa 10189

From Algorithmist

Jump to: navigation, search

Contents

[edit] 10189 - Minesweeper

[edit] Summary

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

[edit] Explanation

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.

[edit] Input

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

[edit] Output

Field #1:
*100
2210
1*10
1110

Field #2:
**100
33200
1*100
Personal tools