51nod Xiaoming and Sudoku

CSDN Q & A 2021-12-30 08:30:47 阅读数:451

51nod nod xiaoming sudoku

Now Xiao Ming has finished some Sudoku games with all the numbers filled in , Preparing to excavate . But before that , He wants you to check whether the problem surface is correct , That is, whether each grid of the completed question surface meets the line 、 Column 、 The little nine palaces contain 1~9.

Input
Enter a number in the first line T, Indicates the number of Sudoku puzzles Xiao Ming has completed .
After that, enter a total of 9 That's ok , Each row 9 The number is separated by a space , Indicates the number in the completed Sudoku .
Output
The output, T That's ok , A string on each line indicates whether the Sudoku is correct .
Output correctly "YES", If there is an error, output "NO".
Data range
about 100% The data of ,1≤T≤5,1≤ Every number ≤9.
sample input
2
7 6 2 5 9 3 1 4 8
9 4 1 2 7 8 5 3 6
8 3 5 4 6 1 7 9 2
1 9 8 6 2 7 3 5 4
4 7 6 3 5 9 2 8 1
2 5 3 8 1 4 6 7 9
3 8 7 1 4 6 9 2 5
5 1 4 9 3 2 8 6 7
6 2 9 7 8 5 4 1 3
8 1 4 7 3 2 6 5 9
9 2 3 6 5 8 1 4 7
5 7 6 4 9 1 2 8 3
3 4 5 2 6 7 8 9 1
1 8 9 3 4 5 3 2 6
2 6 7 1 8 9 5 3 4
7 5 1 9 2 4 7 6 8
4 3 8 5 7 6 9 1 2
6 9 2 8 1 3 4 7 5
sample output
YES
NO




Refer to the answer 1:

Are you really in primary school ?????




Refer to the answer 2:
版权声明:本文为[CSDN Q & A]所创,转载请带上原文链接,感谢。 https://primo.wiki/2021/12/202112300830449034.html