All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Weights (Posted on 2003-06-23)
You are given N number of weights that are all powers of 2. You are also given an item that weighs 1003 lbs.

(1) Exactly how many of those weights would be needed to balance the weight of the item if you could only use one of each weight?

(2) What's the fewest number of weights you can use to balance the weight of the item if there is an unlimited amount of each weight available to you?

 See The Solution Submitted by luvya Rating: 1.8000 (5 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 Solution | Comment 7 of 12 |

First, I hope N >= 10.

Second, there are two ways that the weighing could happen (because the wording wasn't specific). One way is to have the item on one side of the scale all alone, and various weights on the other. The other way is to allow weights on both sides of the scale. Here are the solutions to each way:

Item vs. Weights:
8 Weights are needed. 512, 256, 128, 64, 32, 8, 2, and 1.

Item and Weights vs. Weights:
4 Weights are needed. The Item and Weights 16, 4, and 1 on one side. Weight 1024 on the other.

As for the second part of the equation, the answers are the same. Due to the nature of the weights (all being a power of 2) you gain nothing by having more than one of each weight. Using two of Weight 2^m is silly because 2*2^m = 1*2^(m+1). 2^(m+1) is also a power of two so that weight should be on hand, so it would be better to use that one than two of another.

Later!
 Posted by nikki on 2003-06-25 11:49:10

 Search: Search body:
Forums (0)