Scale Ball Problems

Source: Internet
Author: User
Find different blog posts on the Internet about the scale ball problem. Here we will summarize them. I had a little experience early in the morning. I. 12 small balls in special cases

Question 1: There are 12 balls numbered 1-12. They have the same shape. Except for one of them, they are slightly lighter (called a bad ball) and the other are of the same weight. weigh the ball three times with a balance and find out the bad ball.

Solution:

First weighing

Second weighing

Third weighing

Conclusion: The Bad ball is

1, 2, 3, 4 <5, 6, 7, 8

1, 2 <3, 4

1 <2

1

1> 2

2

1, 2> 3, 4

3 <4

3

3> 4

4

1, 2, 3, 4> 5, 6, 7, 8

5, 6 <7, 8

5 <6

5

5> 6

6

5, 6> 7, 8

7 <8

7

7> 8

8

1, 2, 3, 4 = 5, 6, 7, 8

9,10 <11,12

9 <10

9

9> 10

10

9,10> 11,12

11 <12

11

11> 12

12

 

Question 2: There are 12 balls numbered 1-12. They have the same shape, 11 of which have the same weight, and the other 1 has a slightly different weight (called a bad ball ), but I don't know whether the ball is light or heavy. weigh the ball three times with a balance and determine whether the ball is light or heavy.

Solution:

First weighing

Second weighing

Third weighing

Conclusion: The Bad ball is

1, 2, 3, 4 <5, 6, 7, 8

, 6 <, 9

1 <9

1 light

1 = 9

8

, 6 =, 9

3 <4

3 light

3 = 4

7-fold

3> 4

4 light

, 6>, 9

5 <6

6-fold

5 = 6

2 light

5> 6

5

1, 2, 3, 4 = 5, 6, 7, 8

9, 10 <5, 11

9 <10

9 Light

9 = 10

11

9> 10

10 light

9, 10 = 5, 11

1 <12

12

1> 12

12 light

9, 10> 5, 11

9 <10

10

9 = 10

11 light

9> 10

9

1, 2, 3, 4> 5, 6, 7, 8

, 6 <, 9

5 <6

5 light

5 = 6

2

5> 6

6 light

, 6 =, 9

3 <4

4-fold

3 = 4

7 light

3> 4

3

, 6>, 9

1 = 2

8 light

1> 2

1


II. General summary

The ball problem is a widely spread intellectual problem on the Internet. The most common form is as follows:

There are 12 balls with the same appearance, one of which is a bad ball. The weight of a bad ball is different from that of a good ball. Use a balance to locate the Bad ball within three times and learn whether it is lighter or heavier than a good ball.

Here, I am not going to give a solution to this question, but to give a thought process and a general solution. I try my best to make it simple. It's not that difficult, even if it's a liberal arts background.

Each time we use a balance, the result may be left low right high, left high right low and balanced. Using T-balances, a maximum of 3 T results can be obtained. Each ball may be a bad ball, but it may be light or heavy. Therefore, there are 2n possibilities for N small balls. What is the basis for determining the position and nature of a bad ball? Of course, the information is obtained by using the balance. Each possible combination of balances represents a bad ball arrangement. Every time you use a balance, you can narrow down the possible range of bad balls and finally lock the target. Therefore, the condition for solving this question should be 2n ≤ 3 T. Given that the left side is an even number and the right side is an odd number, the condition is 2n ≤ 3t-1.

Is that simple? Oh, no. We have not considered that the above conclusion is not true. The following process is a bit complicated. Please be clear. For N = (3t-1)/2 balls, the number of left disks and right disks on the balance is. Whether the balance is left low right high or left high right low. The combination of suspect (Bad ball) and suspect gender (Bad ball severity) was reduced to 2a. For example, in the case of left low and Right high, the bad ball is either in the column on the left and lighter, or in the column on the right and heavier. What if the balance is reached? The suspect must be in B balls out of the balance. There are a total of 2B possibilities in combination with gender. The sum of the ranges of the suspects defined by the three States of the balance should be the range of the suspects before the balance. Therefore, 2a + 2a + 2B = 2n = 3t-1. So how should we set the appropriate size for a and B? Yes, we should keep a and B as close as possible, so that no matter what the weighing result is, the remaining workload is almost the same. In some cases, the battle may be solved two or three times, but in some cases the road is long and the distance is long.

The ideal decomposition is 2a = 3t-1, while 2b = 3t-1-1. In either case, we can do the rest with no more than T-1 times. But we cannot do this-because 2a is an even number and 3t-1 is an odd number! In this case, our best solution is to break it into 3t-1-1 | 3t-1-1 | 3t-1 + 1. That is to say, if the balance is balanced at this time, the entire project cannot be completed using a t balance.

With this in mind, the new theorem is:

When 2n ≤ 3T-3, we can find the only bad ball in N balls within t times, and know whether it is lighter or heavier than the standard ball.

By the way, if you do not need to know whether the Bad ball is lighter or heavier than the standard ball, it is enough to satisfy 2n ≤ 3t-1. The proof of this conclusion is more complex than the previous derivation process. I will not talk about it here. If you are interested, I can explain it separately. So far, you have known which questions on the Internet are answered and which are not answered. For example, it would be enough to name 12 balls three times. If we have another ball, We can't judge the weight of the ball. For 14 balls, it is only luck to find the bad ball within three times. If another friend gives you a question, you can reject it.

Now I want to give a general explanation. To simplify the following process, we assume that the number of small balls is exactly (3t-3)/2.

First, we divide the ball into three equal groups of A1 ~ An | B1 ~ Bn | C1 ~ CN, where n = (3t-1-1)/2. When using the balance for the first time, you may wish to place Group A and Group B on the left and right sides of the balance. If the balance is left low and Right high, one of the N balls on the left may be heavier, or one of the N balls on the right may be lighter. The same is true. In this case, go to the following situation (1. When balancing the balance, the bad ball must be in the remaining n balls, (2) discussed this problem.

Scenario 1: A1 ~ is known ~ An has a heavier ball, or B1 ~ A ball in BN is lighter, where n = (3t-1-1)/2. We can take out a good ball in C (all in C are good balls) and put it in B. Then, the following solution is discussed in case (3.

[Case 2] The condition is: The Bad ball C1 ~ is known ~ CN. n = (3t-1-1)/2. We divide C into three groups of A1 ~ Am | B1 ~ BM | C1 ~ CM + 1, where M = (3t-2-1)/2. Note: Group C has one more group than group A and group B. Why? Didn't we say we couldn't do this yesterday? However, we now have another weapon-good ball. Yes, we can take out a good ball from Group A, put it together with group A on the left of the balance, and put group C on the right of the balance, if the balance is left low and right High, it must be that the M balls in group A are heavier or the m + 1 balls in group C are lighter. This is also similar to the situation (3) this is the case. If the balance exists, it means that the M = (3t-2-1)/2 balls in Group B are problem balls. Isn't this exactly the same as what we are discussing currently? So we are back to the situation (2 ).

[Case 3] this situation is the most complicated. What we know is A1 ~ A ball in AM is heavy, or C1 ~ A small ball in CM + 1 is lighter, where M = (3t-2-1)/2. There is also a standard ball. We divide a into α 1 ~ α S | β 1 ~ β s | γ 1 ~ Three groups of Gamma S + 1, and C are divided into ε 1 ~ ε s + 1 | ε 1 ~ * S + 1 | * 1 ~ ε s, where S = (3t-3-1)/2. Place α-ε on the left disk of the balance, and β-E on the right disk of the balance. If the balance is balanced, it means that either the S + 1 ball in the Gamma group is heavier, or the S ball in the ε group is lighter. This is exactly a small scale (3 ). What if the balance is unbalanced? Taking the left low right high as an example, the left disk is α ε, And the right disk is β ε, which cannot be caused by the heavier ε -- if the ball in ε has a bad ball, it will only be lighter than a good ball. It will not be caused by beta light. Therefore, at this time, either one of the s balls in Alpha is heavier, or the other of the S + 1 balls in E. M. Is lighter. This is also the case (3 ).

Now, we have a recursive algorithm in all cases. You can resolve the problem to the following situations:

  1. Use a balance and a standard ball to determine whether a bad ball is light or heavy.
  2. There are two balls, either one of which is heavier or one of which is lighter. There are still standard balls that can be used to find a bad ball using a balance.
  3. One of the three balls is heavy or the other is light. Use a balance to find the bad ball.

I believe these three questions are quite simple. What, you don't know how to do the last one? Er, if the balance is tilted on the 1st and 2nd, the lower side is a bad ball. If the balance is ......

Now, you can try to solve 120 balls in five balances. However, you must first find a very, very large piece of paper.

In addition, for (3t-1)/2 balls, if another standard ball is given, the bad ball can be found within t times based on the condition (2, I also learned that the emphasis is still light. When a standard ball is missing, you can only find the bad ball. This is the problem with 13 balls on the Internet.

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.