Problem Description:
Suppose there are 3 sealed boxes on the table, a box with 2 silver coins (a silver coin = 10 pence), a box with two nickels (one nickel = 5 pence), and a coin in a box with a nickel. These boxes are labeled 10 pence, 15 pence, and 20 pence respectively, and are known to be wrong. Allows you to remove a coin from these boxes, is there any way you can say what's in the box?
Problem Analysis:
Assume:
A--Silver coin, 10 (Penny)
b--nickel, 5 (pence)
So:
AA--20 (pence), AB--15 (pence), BB--10 (pence)
If you draw a:
A-15->aa, 10->ab, 20->BB, Y
-20->ab, 10->aa, 15->BB, Y
-10->aa, 20->ab, 15->BB, Y
-10->ab, 20->BB, 15->aa, Y
If you draw a B:
B-15->BB, 10->aa, 20->ab, Y
-10->ab, 15->aa, 20->BB, Y
-20->ab, 15->BB, 10->aa, Y
-20->bb, 15->aa, 10->ab, Y
As you can see, if you start pumping from a 10-penny box, there are two possibilities of pumping a, and there is a possibility of pumping B.
Starting with a 15-penny box, there's only one possibility, whether it's pumping a or B.
Starting from a 20-penny box, pumping A has a possibility that there are two possibilities of pumping B.
So the final strategy is:
Start pumping from a box of 15 pence, if you draw a, then 15->aa (two silver coins), 20->BB (two nickels), 10->ab (one silver and one nickel)
If pumped to B, then 15->BB (two nickels), 10->AA (two silver coins), 20->ab (one silver and one nickel)