A store keeper want to weight 1 to 4okg of wood according to the user input. What is the minimum number of weights he should buy for fulfill all the user input? what are the weights?
-------------------
suresh
Printable View
A store keeper want to weight 1 to 4okg of wood according to the user input. What is the minimum number of weights he should buy for fulfill all the user input? what are the weights?
-------------------
suresh
He should buy 4 weights. And they are 1,3,9 and 27.
to weigh
1kg = use 1 kg
2 kg = 3 -1 (put 1 kg in the other end of the balance)
3 kg = use 3 kg
4 kg = 3+1
5 kg = 9 -3 -1
6 kg = 9 -3
7 kg = 9 +1 -3
8 kg = 9 -1...and so on.
if you closely look at the weights you can identify that all of them are powers of 3. You can extend this problem up to any powers of 3.
minimum number of weights is 6
weighs
1 kg,2 kg,4 kg,8 kg,16 kg,32 kg.
Oh! sorry.
I dint saw the reply too.
James give the perfect explanation for this problem...Well done james...Happy to see you back...
-------------------
suresh