Question, given 12 balls, one of them is heavier or lighter than the other balls. You can use a balance to weigh these balls, how do you get the special ball out of the 12 balls by only weighing them 3 times?
I have seen similar question before, and believe you can get the answer elsewhere. But anyway, I solved it by my own. You are welcome to try it without seeing the answer.
As usual, I didn't get the answer right away. I managed to find a solution after 2 hours in the end. Here is my solution,
I take examples of 12 balls in following number,
1 2 3 4 5 6 7 8 9 10 11 12
First situation
step 1. compare 1234 against 5678
if they are equal
then
step 2. we compare 123 against 9 10 11
if they are equal then 12 is the special ball
step 3. compare 12 against any other balls to get its weight
step 2 again
if they are not equal, the special ball is among 9 10 11, and we know weather it is heavier or Lighter from step 2
step 3. compare 2 balls within 9 10 11, if they are equal, the rest one is special ball, otherwise we can judge the
special ball by its weight
Second situation
step 1. compare 1234 against 5678
suppose 1234 is heavier than 5678
then we know the special ball is among the 8 balls, and ball 9 10 11 12 are normal balls
step 2. we then compare 1567 against 9 10 11 8
if they are equal, then the special ball is among 234
step 3. compare 2 balls within 234, if they are equal, the rest one is special ball, otherwise we can judge the
special ball by its heavier weight
step 2. again if 1567 is still heavier than 9 10 11 8,
we conclude that it is impossible that the special lighter ball is among 567, otherwise 1567 will be lighter than 9 10 11 8
therefore special ball is among 1 and 8
then by comparing 1 or 8 to any common ball, if 1 is equal to common ball weight, the 8 is a special lighter ball, otherwise, 1 is a special heavier ball
step 2. again if 1567 is lighter than 9 10 11 8,
we conclude that the special ball is among 567, because if 567 are all common balls, by switching side, it won't cause the balance to switch side
and we know, there is a lighter ball among 567
step 3. compare 2 balls within 5 6 7, if they are equal, the rest one is special ball, otherwise we can judge the
special ball by its lighter weight
No comments:
Post a Comment