Puzzling Numbers
A simple form of number puzzle consists of nine rows of nine
numbers or spaces each. One possible
number puzzle is given below:
To solve the problems, numbers are filled into the blank
spaces so that each row, each column, and each darkly
shaded 3 by 3 box has the
digits 1 through 9 in it exactly one time.
Write a program to find a solution to this type of number
puzzle. The input will consist of
puzzles with exactly one solution.
The input consists of one or more test cases.
Each test case will consist of nine lines
with nine digits on each line. There
may be 0 or more blanks between the digits.
The digits '1' through '9' will represent a number and the digit '0'
will represent a blank square. The end
of input is indicated by the end of the file.
For each test case print, in the format shown below, the number
of the case (preceded by the word 'Puzzle'), and the solved puzzle.
Separate the digits by a single space and
have a blank line after each puzzle.
To find more Number Puzzles, look at Dell Magazine's Math
Puzzles and Logic Problems.