#K46162. Missing Digit in Almost Solved Sudoku
Missing Digit in Almost Solved Sudoku
Missing Digit in Almost Solved Sudoku
In this problem, you are given a 9x9 Sudoku board that is almost completely solved except that one cell in the board is empty (represented by a 0). Your task is to find and output the missing digit in the row that contains the empty cell. In a fully solved row, the sum of the digits from 1 to 9 is (\sum_{i=1}^{9} i = 45). By subtracting the sum of the known digits from 45, you can determine the missing digit.
inputFormat
The input consists of 9 lines, each containing 9 space-separated integers. The board is guaranteed to contain exactly one 0 which represents an empty cell. You need to read the board from standard input.
outputFormat
Output the missing digit (an integer) that completes the row containing the 0. Print the result to standard output.## sample
5 3 4 6 7 8 9 1 2
6 7 2 1 9 5 3 4 8
1 9 8 3 4 2 5 6 7
8 5 9 7 6 1 4 2 3
4 2 6 8 5 3 7 9 1
7 1 3 9 2 4 8 5 6
9 6 1 5 3 7 2 8 4
2 8 7 4 1 9 6 3 5
3 4 5 2 8 6 1 7 0
9