Omnipotent Data

Chapter 105: Rubik's Cube Matrix

  Matrix of Rubik's Cube, also known as magic square, vertical and horizontal graph.

   refers to an N-order matrix with the same number of rows and columns arranged by a total of N^2 numbers from 1 to N^2, and the sum of each row, column, and diagonal is equal.

   In "Shooting the Condor", Guo and Huang are chased by Qiu Qianren to Heilongtan, hiding in Aunt Ying's cabin. Ying Gu asked a question: fill in the numbers 1-9 in a three-row and three-column table, requiring that the sum of each row, column, and two diagonals are equal. This question stumped Aunt Ying for more than ten years, but Huang Rong answered it all at once.

  492

  357

  816

   This is the simplest third-order plane Rubik's Cube matrix.

   And today, the question Lao Tang presented is a more difficult five-order Rubik's Cube plane matrix.

   The difficulty of calculation, I don't know how much higher it is than the third-order Rubik's Cube matrix.

   However, since the Rubik's Cube matrix is ​​defined by mathematicians, it naturally has a unique set of calculation rules.

   According to the value of N, there are three situations.

  When N is an odd number, when N is a multiple of 4, when N is another even number!

   Old Tang’s question is to find a 5th-order plane Rubik’s Cube. Obviously, the rule of operation where N is an odd number can be applied.

   Cheng Nuo silently recalled in his mind the rule of filling in a plane Rubik's Cube when N is an odd number.

  "When N is odd

  ① put 1 in the middle column of the first row;

  ②The numbers from 2 to n×n are stored in sequence according to the following rules:

   Walk in the direction of 45°, such as to the right

   The row stored in each number is reduced by 1 from the row of the previous number, and the number of columns is reduced by 1

  ③If the range of rows and columns exceeds the range of the matrix, wrap around.

   For example, 1 is in the first row, then 2 should be placed in the bottom row, and the number of columns is also reduced by 1;

  ④If there is a number in the position determined by the above rules, or the previous number is in the first row and the nth column,

   puts the next number below the previous one. Note①)

   "So, the correct answer should be..."

   Cheng Nuo constructed a grid model in his mind. Soon, 25 numbers were filled in.

  唰唰唰唰~~

   In the eyes of the classmates, Cheng Nuo didn't hesitate. He took the chalk and walked along the blackboard, and the dust was flying. There is no pause in the middle, all in one go!

   Raises hands and feet, revealing extremely powerful confidence.

   "Okay, teacher, I'm finished." Cheng Nuo turned around, threw the chalk head on the desk, and said to Old Tang with a smile.

   "Okay, let me take a look, did you fill it in, right?" Old Tang looked at the filled grid on the blackboard with a curiosity.

  15812417

  16147523

  22201364

  321191210

  92251811

all right! !

   The position of the 25 digits is exactly the same as the correct answer.

  The sum of every row, every column, every diagonal is 65! ~

   Old Tang glanced at Cheng Nuo with his usual expression in surprise. Then, under the expectant gaze of the whole class, he announced, "Cheng Nuo's answer... is correct!"

   Wow~~

   The whole class was in an uproar.

   As expected, Cheng Nuo is still as tough as ever!

   Can't compare, really can't compare.

   The brain configuration of them and Cheng Nuo is simply not on the same level.

   Xueba is an existence worthy of being looked up to by the learning scum!

Old Don looked at Cheng Nuo and said, "Since Cheng Nuo is the first student to solve this problem, then my'special' reward belongs to Cheng Nuo. Cheng Nuo, can you tell everyone How did you solve this problem?"

   "No problem." Cheng Nuo nodded, turned and pointed at the question, "Actually, this question is very simple."

   This question... is simple?

   Okay, you are a Xueba, you have the final say.

   The whole class rolled their eyes.

   Cheng Nuo shrugged and continued preaching as usual. "Before I talk about this problem, I want to tell you a model called the Rubik's Cube matrix!"

   Why can Cheng Nuo know the Rubik's Cube matrix?

   It stands to reason that in high school, this knowledge will not be involved.

   But who is Cheng Nuo? He is a master!

One of the characteristics of    Xueba is that they will never be satisfied with just learning the knowledge in class!

   Do you still remember the pile of books about the world's mathematical problems that Cheng Nuo bought from the bookstore? This Rubik's Cube matrix was used in the reasoning process of one of the difficult problems. Cheng Nuo wrote it down by the way.

   Cheng Nuo stood on the podium and explained all three solutions of the Rubik's Cube matrix.

   "After listening to this theorem, do you think this question is much simpler. First of all, the number in the middle of the first line must be 1, and the position of the number 2..."

   The students under the podium were dizzy and unconscious, but Cheng Nuo spoke on the podium with relish.

   "Well, that's all I want to say, thank you everyone!" After speaking, Cheng Nuo stepped off the stage.

   Papa~~

   The whole class clapped subconsciously.

   After Cheng Nuo stepped off the stage, Comrade Old Tang stood at the stage with an embarrassed expression.

   girl! I'm done talking about everything I want to talk about, let me talk about it? !

   Originally, Comrade Tang wanted to use this topic to derive the Rubik's Cube matrix and radiate students' thinking before the college entrance examination.

   But now...

   Uh... Well, Cheng Nuo explained the Rubik's Cube matrix in more detail than me, so I should not show my ugliness as a teacher.

"Okay. Classmates, let's take out the set of Hengshui real questions issued last week, and let's talk about the set of test papers." Old Tang coughed awkwardly, and did not ask the students if he understood, he hurriedly changed the subject. .

   "Wow, Mu Leng, Cheng Nuo is really amazing. Such questions are all right!" Su Xiaoxiao's bright eyes were full of little stars.

   The corners of Mu Leng's mouth rose slightly, "This is the... awkward him!"

  …………

   "Okay, get out of class is over. Mu Leng, Cheng Nuo, you two come to the office with me."

   Accompanied by the get out of class bell, Old Tang just finished the last topic.

   Cheng Nuo and Mu Leng looked at each other, they were all confused. They didn't know what Old Tang was looking for, but they still followed Old Tang to the office honestly.

  When going down the stairs, Cheng Nuo approached Mu Leng and whispered in a slightly worried tone, "Sister Leng, did you say that the relationship between the two of us was discovered by Old Tang?"

   Mu glanced at Cheng Nuo indifferently, and spoke word by word: "You-say-what!"

   Cheng Nuo shrank her neck and said with a scornful expression, "Just kidding, kidding."

"However, Sister Leng, do you really no longer consider the matter of the two of us? You see, you are a schoolmaster, and I am a schoolmaster. The schoolmaster is matched by the schoolmaster. The two of us can be said to be right. The child born. It must be Xueba!" Cheng Nuo said with clenched fists.

   Mu coldly pursed his lips, and said ambiguously, "After the college entrance examination, we are talking about this issue."

   "Okay, I'll wait for you." Cheng Nuo smiled faintly.

  ………………

  Note①: The algorithm for the other two cases of Rubik's Cube matrix. (The number of positive characters has reached 2000. This is not the number of water characters. This is to help you learn this question! Please understand the author's good intentions.)

  (2) When N is a multiple of 4

  Using the symmetric element exchange method~www.readwn.com~First fill in the matrix from 1 to n×n from top to bottom and from left to right

Then the numbers on the two diagonals of all 4×4 sub-squares of the square matrix are exchanged symmetrically about the center of the large square matrix (note the numbers on the diagonals of each sub-matrix), namely a(i, j) Exchange with a(n+1-i, n+1-j), and the numbers in all other positions remain unchanged. (Or leave the diagonal unchanged, other positions can also be exchanged symmetrically)

  (3) When N is other even number

   When n is an even number that is not a multiple of 4 (that is, 4n+2 shape): first decompose the large square matrix into 4 odd (2m+1 order) sub-squares.

  According to the above odd-order Rubik's Cube, assign the corresponding values ​​to the 4 sub-square matrices that are decomposed

   The upper left subarray is the smallest (i), the lower right subarray is the next smallest (i+v), the lower left subarray is the largest (i+3v), the upper right subarray is the second largest (i+2v)

   means that the corresponding elements of the 4 sub-square matrix differ by v, where v=n*n/4

  The arrangement of the four sub-matrices from small to large is ①③④②

Then exchange the corresponding elements: a(i,j) and a(i+u,j) are exchanged in the same column (j<t-1 or j>n-t+1 ),

   Note that j can go to zero.

  A(t-1,0) and a(t+u-1,0); a(t-1,t-1) and a(t+u-1,t-1) two pairs of elements exchange

   where u=n/2, t=(n+2)/4 The above exchange makes the sum of each row and column equal to the elements on the two diagonals.

  …………

  PS: I have detailed the steps to solve the problem to this level. If you never again...I can't help it.

Tap the screen to use advanced tools Tip: You can use left and right keyboard keys to browse between chapters.

You'll Also Like