Recursive and divided treatment

Source: Internet
Author: User

Board Overlay

2^k Checkerboard, there is a flaw, with an L-shaped jigsaw puzzle to cover the board.

Apply each time you apply the defect around ... 23333

Reference

intdir[4][2] = {{0,0},{0,1},{1,0},{1,1}};///The checkerboard L shape corresponds to the difference between the missing latticeintgraph[10000][10000];voidSet_piece (intRintCintx) {///R,c represents the position to be applied, X indicates which type to smear, and the other means not to smear .     for(inti =0; I <4; i++){        if(i = =x)Continue; Graph[r+dir[i][0]][c+dir[i][1]] = x+1; }}voidChessboard (intSxintSyintXintYintLen) {    if(len = =1)        return; ints = len/2; intDX = x >= SX + S;///Identify defect Locations    intdy = y >= sy +s;  for(inti =0; I <4; i++){        if(dir[i][0]! = DX | | dir[i][1] !=dy)Continue; Set_piece (SX+s-1, sy+s-1, i);  for(intj =0; J <4; j + +){            intSSX = SX + dir[j][0] *s; intSsy = sy + dir[j][1] *s; if(i = =j)            {chessboard (ssx,ssy,x,y,s); }            Else{                intex = SX + S-1+ dir[j][0]; intEY = sy + S-1+ dir[j][1];            Chessboard (ssx,ssy,ex,ey,s); }        }    }}

Recursive and divided treatment

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.