Sunday, July 1, 2012

10 Bags of Gold Coins

 

You are given 10 bags of gold coins. Nine bags contain coins that each weigh 10 grams. One bag contains all false coins that weigh one gram less. You must identify this bag in just one weighing. You have a digital balance that reports the weight of what is placed on it.

 

 

 

Solution

1) Find an empty bag (labeled "E")
2) Place 1 coin from bag 1 into E
3) Place 2 coins from bag 2 into E
...
10) Place 9 coins from bag 9 into E
11) Place 10 coins from bag 10 into E
12) Weigh bag E on your digital scale
If all coins were 10 grams, the bag would weigh 550 grams. Thus, 550 − weight will tell you how many coins are too light. Since this number of coins correlates to the bag from which the coins came, you now know which bag contains the light coins.
Source 
  • The Algorithm Design Manual, 2nd Edition S. Skeina

3 comments:

Unknown said...

Nice blog. Now buy 2 gram gold coin online at karatcraft with best price in India. http://www.karatcraft.in/gold-coins/2gm-gold-coins

Unknown said...

Your writing has impressed me. It’s simple, clear and precise. I will definitely recommend you to my friends and family. Regards and good luck
Goldankauf Wien
Goldankauf Graz
Goldankauf Linz
Goldankauf Salzburg
Goldankauf Vorarlber

A friend said...

brilliant

Post a Comment