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: