Question: there are 12 balls of the same size and color. One ball has different weights and has a balance. Check which ball has a problem as few times as possible, the problematic ball is heavier or lighter than other balls!
I found the origin of my thinking limitations: I used to think about this question:, which is a common thinking of people, just like me, later I thought of the following types:, and, because the number behind is a multiple of the previous number. I want to use this relationship to find out that there is only a balance, no weight, and no specific multiples, I can only see whether the balance is tilted to the left or right, and I gave up these ideas. In the first 3, I found that at, I could split the 3, at this time, someone put forward an idea. I understood it a little troublesome. After a long time, I figured out how many times I had to find out the limitations of my thinking, so next I will first describe his algorithm I admire:
Step 1: divide the ball number 1-12 into three heaps. we divide it into 1-4, 5-8, and 9-12, and stack any two onto the left and right sides of the balance, suppose I put 1-4 on the left, 5-8 on the right, and 9-12 on the left.
Step 2: Check whether the two sides of the balance are balanced. If the balance shows that the problematic ball is in the third heap (Thinking limitations 1: focus only on the two ends of the balance, and the rest is information)
Step 3: this is a good solution. Here it is simple. You can use a 1-8 ball to name the four. The worst case is that you have called it three times, there is a problem with the balance between the three balances and the fourth one. I want to know the weight is called once.
There is also a way to compare two standard balls to any two of the four balls and check the balance of the balance.
Another method is to take three standard balls and compare them with any two of the four balls -----> end
Step 4: problems caused by unbalanced balances in step 2. If 1-4 on the left> 5-8 on the right (> replaces the weight on the left, it indicates which side of the balance is lower. Some people will be confused here, the left-heavy and right-heavy ball only indicates that the eight balls have a problem. It may be on the left. The ball is heavy, it may be on the right, and the ball is light ), take 3 balls out of the left and put them out (if the ball is 2-4 ), randomly place three balls on the right disk on the left disk (for example, 6-8) and three standard balls on the right disk, in this case, three cases (left> right, left <right, left = right) are analyzed in sequence (Restricted thinking 2: In Step 4, the problem ball is in step 1-8, but dare to throw the ball which may be the answer)
Step 5: Left = right: it means that 6-8 is the same as the three standard tools used, indicating two problems: in the three balls (2-4) that are taken out, and the problem ball is heavy. The three balls are good to solve, and follow the third step --> end
Step 6: Left> right: Do not take out 2-4 left> right, take out and change the ball or left> right, it means the problem lies in 1 and 5, test with standard ball --> end
Step 7: Left <right: the tilt direction of the balance has changed. Two problems are explained: The problem ball is in the range of 6 to 8, and the problem ball is light --->
Step 8: Repeat Step 4 Before testing,> change to another <--> Solution
Conclusion: The thinking is too stiff. You can understand it only after two more questions are asked.
Code: appended to the end
Advantage: high operation efficiency
Disadvantage: programming efficiency is too low
Method 2: Generally, the ball is divided into four three parts, each named.
Advantage: programming efficiency is much higher than the above method
Disadvantage: the running efficiency is a little lower than the above method
Discover your own thinking limitations based on the algorithm of a question