Principle and demo of board coverage

Source: Internet
Author: User

Note:ArticleContent Source: ComputerAlgorithmDesign and Analysis
DemoProgramIt is done by myself. Please advise me more!

In a checkerboard composed of 2 ^ K * 2 ^ K squares, if there is a square different from other squares, it is called a special square and changed to a special checkerboard. Obviously, there are 4 ^ K positions in the special square on the board. Therefore, for any k> = 0, there are 4 ^ k different special chessboard. The special checkerboard shown is one of the 16 special checkerboards when k = 2.

In the Board coverage problem, we need to cover all the squares except the special squares on a given special card with different forms of L-shaped dominoes in medium 4, and no two L-type dominoes can overlap. Yi Zhi, in any 2 ^ K * 2 ^ K board, the number of L-type dominoes used is exactly (4 ^ k-1)/3.

With the sub-governance policy, you can design a simple algorithm to solve the Board problem.

When K> 0, split the 2 ^ K * 2 ^ K board into 4 2 ^ (k-1) * 2 ^ (k-1) Sub-boards, as shown in.

The special check box must be located in one of the four smaller check boards. The other three check boxes do not have special check boxes. To convert these three sub-boards without special squares into special ones, we can use an L-shaped bone card to cover the convergence of these three smaller boards, as shown in, the square covered by the L-type dominoes on the three sub-boards becomes a special square on the board, thus turning the original problem into four small-scale board coverage problems. Recursive use of this split until the checker is reduced to 1x1.

 

 

For branch algorithms, see the demo program.

Program running:

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.