Problem of finding abnormal balls for N balls

Source: Internet
Author: User

1. There are 8 balls of the same size and color. One of them is different in weight from the other 7. At least a few times, it determines whether the ball is light or heavy.

Warm-up questions

There are eight balls, one of which is slightly different, and it knows that it is slightly lighter than the other seven, and the other seven have the same weight. Now there is only one balance, but there is no weight, can I find out which ball is different from the other seven if I only name it twice?

Place three balls at each side of the balance.

1 If balancing. Take one of the six balls that have been called, and the other two balls that have been called are called, if it is not balanced, the ball you just got is the ball you want to find.

2. If the ball is unbalanced, place any two balls from the light three balls on both ends of the balance. If the ball is balanced, the third ball is the ball you are looking, the weight is the ball to be searched.

It is easier to know whether the special ball is light or heavy.

Let's look at the original question again:

Take four balls and two sides (Group A and Group B );

If 1 is not the same. It indicates that the ball is in the four.

Take two from the other four balls and name a. Remember which side is heavy and which side is light.

If 11 is the same, it is in B.

If 12: it is in.

Take a ball from the suspect group and name the other six as needed,

If the value is 111: different, it is the ball. If the value is heavy, it indicates that it is heavy, and vice versa.

If 112 is the same, it indicates the remaining one. At this time, we can infer the weight of the last ball based on the weight of the previous one.

If 2 is the same as heavy, it means that in the other four, repeat once according to the process of 1.

 

Extension

One or 12 balls have different weights. You can name them three times for a balance, and find out the problematic ball.

1) divided into three ABC groups, four in each group. The AB group is called once.

If 1 is the same as heavy, the exception ball is in group C.

2) group C should have three normal three.

If 11: The weight is the same, the remaining part of group C is the exception ball.

3) Compare the exception ball with the normal one to know the status.

If 12: The values are different, the three are abnormal and the current status is recorded, which is lighter than normal.

3) compare two of the three balls

If the value 121 is the same, it indicates that the remaining one is an abnormal ball. You can check whether the ball is light or heavy based on the previous status.

If 122 is not the same as the weight, you can also know according to the previous status

If 2: not the same weight, the exception ball is in these 8, record the weight status

2) take out three of the four heavy Balls, add the ball with a light side to the left, and put the ball with the remaining heavy sides on the right to add three normal balls.

If 11: The weight is the same, the remaining three balls on the light side are light.

3) Name three balls at a time.

If 111: The weight is the same, the remaining one is a light ball.

If 112: different, the lighter one is the lighter ball.

If 12: The weight is different. If the three normal balls are heavy, one ball on the heavy side is heavy. Otherwise, the three balls have one heavy ball.

3) select two names for the three balls.

If 121: Same weight, the third weight is the ball.

If the weight is 122: different, the weight is heavy.

2 13 balls how three times to find an abnormal ball http://wenku.baidu.com/view/6643a7215901020207409c81.html

3 8 balls called 4 find 2 abnormal balls solution http://hi.baidu.com/kyng1988/item/a26f1194f3f4ceb4cd80e514

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.