Sudoku ~~~~~~ Only remember the current eye pain

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.