Vzveshivanie coins (task Saladin) user
kadiyabdurahman asked me a puzzle to weigh the coins, called " problem Saladin ". Although during his long life, I nareshalas targets for the weigh-in, this problem did not occur to me and had to break down. Problem is rather amusing, especially those that allow seemingly trivial complication.
History: This story happened a long time ago, during the time of the Crusades. One of the knights was captured by Muslims, was captured and brought before their leader - the sultan Saladin, who announced that frees the prisoner and his horse, if he receives a ransom of 100,000 gold coins.
- Oh, great Saladin, - Then turned to the Sultan of the knight, whose soul was not for a penny - you deprive me of last resort. We have at home a wise and resourceful prisoner given a chance to go free. If he decides a given puzzle, let him go on all four sides - if not, the amount of foreclosure doubles!
- So be it, - Saladin replied, and he adored puzzles. - Listen well. Do not handle the job until the morning - blame yourself!
problem Saladin: you give twelve gold coins and simple scales with two cups, but without the weights. One of the fake coins, but it is unknown, it is easier or harder to present. You must find it in just three weigh-in.
Complication: You must not only find the counterfeit coin, but also indicate lighter or heavier than the rest of it. Moreover, the counterfeit coin can and not be at all and, if so, you are also obliged to provide!
Solution:
enumerate 12 coins: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12;
renumber the 24 configurations (possible "State" system, as one would say physics), 1L, 2L, ..., 12L, 1H, 2H, ..., 12H, where, for example, 7H means a configuration where the 7-th coin is heavy;
Enumerate cup : left (L), right (R) and resting (D);
enumerate the results of measurements, XYZ, where each character can take three values, A (left outweighed the cup), R (right outweighed the cup) O (equilibrium, then there is a possible culprit in the cup resting). For example, XYZ = LPO means the result, in which the first measurement outweigh the left cup, in the second right, and in the 3 rd triumph balance. At first glance, just maybe 3 3 = 27 rezultata options, but some (three) of them can not be realized because all there are only 24 configurations. Thus, properly chosen dimensions contain redundant information that can be used for "complicating" the problem. Saladin could not leave the possibility lack counterfeit coin, thereby adding the 25-th configuration of the "N" (all coins are normal).
We choose three weighting placing four coins in each of the three cups, so each configuration leads to a unique result . Regular simple procedure selection is described at the end of our story. Empirically, it is sufficient to require that no two coins are not "paired" in all three dimensions (then there was not based on the same cup or on the opposite neotdyhayuschih cups). In other words, the coins can mate, but not always , a maximum of twice. For example, we choose a partition of the coins into groups to weigh so:
| # | Left | Right | Resting |
| (1) | 1,2 , 3,4 | 5,6,7,8 | 9,10,11,12 |
| (2) | 1,8,9,11 | 3,4,5,10 | 2,6,7, 12 |
| (3) | 3,7,9,12 | 1,4,6,11 | 2,5,8,10 |
Each configuration leads to a unique result XYZ. For example, configuration 1L (1 st coin light) gives LLP, where nikakaya other configuration does not lead to the LLP (LLP means that in the first and second dimensions of stole the cup A, and in the 3 rd - H cup). Configuration 2L (2 nd coin light) gives LOO (which means that in the first dimension stole cup A, and in the 2nd and 3 rd realized equilibrium.
call attention to the
that no configuration can not lead to LLL, PPP
, or LLC. If Saladin complicated problem, adding the 25-th configuration of the "N" (all coins are normal), then obviously result LLC would exercise (N ↔ LLC).
enumerate all configurations and the corresponding measurement results in tabular form:
| 1L | → | ЛЛП | | 1H | → | ППЛ |
| 2L | → | ЛОО | | 2H | → | ПОО |
| 3L | → | ЛПЛ | | 3H | → | ПЛП |
| 4L | → | ЛПП | | 4H | → | ПЛЛ |
| 5L | → | ППО | | 5H | → | ЛЛО |
| 6L | → | ПОП | | 6H | → | ЛОЛ |
| 7L | → | ПОЛ | | 7H | → | ЛОП |
| 8L | → | ПЛО | | 8H | → | LPO |
| 9L | → | ALL | | 9H | → | OPP |
| 10L | → | GCO | | 10H | → | OLO |
| 11L | → | ARS | | 11H | → | ALI |
| 12L | → | RV | | 12H | → | PLO |
By the uniqueness of the table direction of the arrows can be reversed and thus avoid the wrath of Saladin. Naturally, the decisions (in terms of choice of the partition of coins weighing) is set and the option presented above only one possible. Find a partition that is not working, it is easy empirically, but you can follow the regular "procedure", the simplest selection procedure begins with the desired result table. Naturally, it is enough to make half of the table (corresponding to the fact that the counterfeit coin L) - the other half will automatically (replacing A ↔ P).
Easy:
write a column results in a 12-XYZ, such as the third column of the table above. All that should be require that no result was repeated twice, and that column does not contain the "opposite" of the result (that is, if we wrote ALL, then result of AFP should be excluded). We enumerate the rows column (and thus there is 1-st column of the table). After that, the partition of the coins to three dimensions is obtained easy reading. The value of X determines the place (the cup) of a coin in the first dimension, Y second, and Z in the third. For example, the average reading letters (Y) column, we put in the second dimension in the left cup of coins (1,8,9,11), and the right (3,4,5,10).