Skip to main content
GameDev.net gamedev.net
🔒 Locked

Math problem

Started by CoMaNdore Dec 8, 2005 at 8:23 PM 7 replies 650+ views
Original Post
CoMaNdore
CoMaNdore
Okay first off, some info: This is in no way a math class question. I know some ppl that had it for xmas exam last year, and they gave it to me for fun. And now the fun is gone and I can for the love of live get the thing working. I would like some serius hints AND NOT! the complete sulution. Now the problem: I have 12 balls, one of them weight more or less than the other 11. Find you wich ball what Is lighter/hevyier than the other balls. To do this I have a weight that (dunno the english word for it so ill rather try to decribe it for you guys) Its a weight that can weight 2 diffrent amounts of stuff and return wich one was lighter by tipping to one of the sides. I can use the weight 3 times and I and suposed to find the ball by then. ( after the 3th'd weighting ) Where I am: Im always down to 3 balls but have no way to just use the last weigh to find the right ball out of 3. In advance thanks and home I dint forgett to include some options..
Me
Stani R
Stani R
I tried thinking about it for a minute, then googled it, and immediately came up with the solution. I won't post the link since you did not want it, but the query was "12 balls and a weight". Yeah, I guess I'm a cheater ^_^

The hint that you're looking for is this: number the balls 1 to 12 and start off by dividing them into three equal groups. You are never weighing all the balls on the scale at the same time.
deavik
deavik
Test 6 balls at a time for the first 2 weighs, 3 in each pan. It will be obvious which of the groups of 3 contain the heavier ball. Now you have 3 balls and the final weigh. Take any 2 of them, not all 3, and put them on the 2 pans. If they are balanced (... this is where you have to figure it out [smile]), and if the balance tips to one side-
Stani R
Stani R
Quote:
Original post by deavik
Test 6 balls at a time for the first 2 weighs, 3 in each pan. It will be obvious which of the groups of 3 contain the heavier ball. Now you have 3 balls and the final weigh. Take any 2 of them, not all 3, and put them on the 2 pans. If they are balanced (... this is where you have to figure it out [smile]), and if the balance tips to one side-

If I understood the question correctly, that approach does not work because the ball might be lighter and not heavier.

nilkn
nilkn
The trick with this problem is to break the set of 12 into three groups of four. When you weigh the first group of four against the second group of four, a variety of outcomes occur. With some other weighings and logic, it is possible to derive the index of the ball of odd weight.

While we're at it, I might as well post another similar brain-teaser:

There are three baskets. One contains only apples, another contains only oranges, and the third contains a mixture of apples and oranges. Moreover, all three baskets are labeled, however incorrectly. Determine a method of correctly re-labeling all three baskets according to their contents whereby you draw only a single fruit from a single basket, without directly observing it's contents.
Stonicus
Stonicus
I take a fruit from the one labeled Apples/Oranges. Since it is labeled incorrectly, whatever I pull out of it is wrong. If I pull an orange out, it must be the Orange basket. Then, I look at the one labeled Orange basket, it is wrong. It is either the Apples, or Apples/Oranges. It must be the Apples basket. If it was the Apples/Oranges basket, then I only switched two labels, not 3, as the Apples label doesn't move. So if I pull an orange out of the Apples/Oranges basket, then that is the Orange Basket, the Apple Basket is the Apples/Oranges Basket, and the Orange Basket is the Apple Basket.
deavik
deavik
Quote:
Original post by lightbringer
Quote:
Original post by deavik
Test 6 balls at a time for the first 2 weighs, 3 in each pan. It will be obvious which of the groups of 3 contain the heavier ball. Now you have 3 balls and the final weigh. Take any 2 of them, not all 3, and put them on the 2 pans. If they are balanced (... this is where you have to figure it out [smile]), and if the balance tips to one side-

If I understood the question correctly, that approach does not work because the ball might be lighter and not heavier.

Ohhh, sorry, I overlooked that part.
Trap
Trap
If you can do, it has to be in a sequence of 12=>6=>3=>1 balls that are still candidates for being heavier/lighter.

3 groups of 4 balls will not work because that brings down the candidate set to either 8 or 4 balls. You need 6 candidates in the second step.
alvaro
alvaro
Quote:
Original post by Trap
If you can do, it has to be in a sequence of 12=>6=>3=>1 balls that are still candidates for being heavier/lighter.

3 groups of 4 balls will not work because that brings down the candidate set to either 8 or 4 balls. You need 6 candidates in the second step.


No, that is not the right way to think about this problem. Let's label the balls from 1 to 12. We have 24 cases to distinguish:
1 is too heavy.
1 is too light.
2 is too heavy.
2 is too light.
...
12 is too heavy.
12 is too light.

Every time you use the balance, you can get three different results: the left side is heavier, the right side is heavier, or they are both equal. The result will partition the cases in three groups. Try to make the groups as equal in size as possible, and then the sequence of number of cases left is 24 => 8 => (2 or 3) => 1.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.