divide $277 into a number of bags so that i can ask for any amount between $1 to $277 and you can give me a proper amount of money without opening them.what is the minimum number of bags you need?
Answers
Answer:
$27790
Step-by-step explanation:
Given:
$277 is total amount
To find:
Divide $277 into a number of bags so that i can ask for any amount between $1 to $277 and you can give me a proper amount of money without opening them
Solution:
Given the total amount is $277
Let's start from $ 1
We have to Keep a bag with $ 1 so that if he ask $ 1 to give
And we should also keep a bag with $ 2 so that if he ask $ 2 to give
If he ask $ 3 we can give $ 1 bag and $ 2 bag so we don't need $ 3 bag.
If he ask $ 4 we can't give him with $ 1 bag and $ 2 bag so we need to keep $ 4 bag.
If he ask $ 5 we can give $ 4 bag and $ 1 bag [∵ 4+1 = 5]
Just like that to give $ 6 bag we can give $ 2 bag and $ 4 bag [∵ 2+4=6] and for $ 7 bag we can give $ 1 bag $ 2 bag and $ 4 bag so here we don't need $ 5, $6 and 7$ bags
If he ask $ 8 we can't give him with above bags so we should keep $ 8 bag.
The order of the bags we choose to keep is $ 1, $ 2, $ 4, $8.
If we follow the order the next bags will $ 16, $ 32, $64, $ 128,
After making $ 1, $ 2, $ 4, $ 8, $ 16, $ 32, $ 64, $ 128, bags the remaining Money will be = 277 - [1 + 2+ 4+ 8+ 16+ 32+ 64+ 128 ] = 22
So we can keep last bag with $ 22
⇒ The bags we divided are $ 1 bag, $ 2 bag, $ 4 bag, $ 8 bag, $ 16 bag, $ 32 bag, $ 64 bag, $ 128 bag and $ 22 bag
Total Number of bag = 9 bags
The minimum number of bags we need 9 bags
#SPJ2