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?
(In reply to
Balancing Act by Sanjay)
It's possible to go further than Sanjay's more efficient solution and balance the item with only one of the 2^n weights..... move the balance's fulcrum.
For simplicity if one takes the 2^0 (1lb) weight and constructs the balance such that the 2^0lb weight is 1003 times further from the fulcrum than the 1003lb item then the balance is errr... balanced. Clearly this principle works for any of the 2^n weights, provided the balance is constructed correctly.
|
Posted by fwaff
on 2003-06-23 21:44:42 |