|
1. Input: the order of the Rubik's Cube Output: the complete Rubik's Cube
2 In addition, I want to ask a question. The questions are as follows:
Given n cubes of different sizes, the area of each of these cubes is between 1-n, stack these cubes into two towers, and ask what is the minimum height difference between the two towers
Attachment: The magic square matrix refers to the N×N square matrix with natural numbers 1, 2,..., N2, and the value of each element is not equal, and the sum of N elements in each row, column, and main and sub-diagonal lines Are all equal.
For odd-order magic squares, the Dole Rob algorithm can be used to generate them. The process is: start from 1, and insert each natural number until N2. The principle of choosing the insertion position is:
a. The first position is in the middle of the first line;
b. The new position should be at the upper right of the most recent insertion position, but if the upper right position has exceeded the upper boundary of the square matrix, the new position shall be the lowest position of the selected column; if it exceeds the right boundary, the new boundary shall be the selected row The leftmost position;
c. If the last inserted element is an integer multiple of N, select the position in the same column in the next row as the new position. |
|