Just remember to block the strong (~ Do not spend money ~), that what to do, tonight is really the eye pain, only remember the current strong, buckle buckle, left left and left left on left. Finally, the result was stuck to the output format ...This problem needs to be done again.
Hey Greedy,don ' t fretwhat you see are what getyou name It,i has it please don't buckle aroundAt The earliest, I was using two for loop traversal to find the result is a constant error, ....... ..... First pay the revised code, one will be forced to achieve a wave with the original thought.
1#include <stdio.h>2 inta[9][9];3 intFlag;4 BOOLCheckintYintXintMark)5 {6 for(intI=0;i<9; i++)7 {8 if(a[y][i]==Mark)9 return false;Ten if(a[i][x]==Mark) One return false; A } - for(intI= (y/3)*3;i< (y/3)*3+3; i++) - for(intJ= (x/3)*3;j< (x/3)*3+3; j + +) the { - if(a[i][j]==Mark) - return false; - } + return true; - } + intN; A voidDFS () at { - if(n==Bayi) - { - return; - } - for(inti=n,mark=0; i<=Bayi; i++) in { - to if(i==Bayi) + { -n=Bayi; the return; * } $ inty=i/9, x=i%9;Panax Notoginseng if(a[y][x]==0) - { the for(intI=1; i<=9; i++) + { A if(check (y,x,i)) the { +a[y][x]=i; -i++; $ DFS (); $i--; - if(n==Bayi) - { theI=Bayi; - Break;Wuyi } thea[y][x]=0; - } Wu if(i==9) - { Aboutmark=1; $ } - } - if(Mark) - Break; A } + } the } - intMain () $ { the intT; thescanf"%d",&t); the while(t--) the { - for(intI=0;i<9; i++) in for(intj=0;j<9; j + +) thescanf"%d",&a[i][j]); then=0; About DFS (); the for(intI=0;i<9; i++) the { the for(intj=0;j<9; j + +) +printf"%d", A[i][j]); -printf"\ n"); the }Bayi } the return 0; the}
Sudoku ~~~~~~ Only remember the current eye pain