Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Nasko loves to play Minesweeper on his PC. In Minesweeper the playfield is a 3x3 grid and in some of the squares there is a bomb.
- The goal of the player is to write a number in every cell that doesn't have a bomb. The number must show how many bombs are in the
- neighbour cells (cells that have common edge or a side). Write a minesweeper program, which takes the bomb positions as input and prints the grid with numbers filled in.
- Input: In the first three lines of the standard input there are 3 real numbers and each one of them has value of either 0 or 9 (9 - bomb/ 0 - no bomb). The numbers are separated with a single whitespace.
- 9 0 0
- 0 0 9
- 0 0 0
- Output: In the standart output, the program should print 3 lines with 3 real numbers in them. At the position of the "0"-s from the input, there shoult be a number indicating the bombs around it. Numbers are separated by a single white space:
- Input: Output:
- 9 0 0 9 2 1
- 0 0 9 1 2 9
- 0 0 0 0 1 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement