Wednesday, May 31, 2017

Three Sisters

A farmer has three daughters. The oldest sister always tells truth, the youngest always lies, the middle is evil, she tells truths or lies as she pleased. Unfortunately, all three sisters look the same. You are a knight, who is allowed to ask 3 yes/no questions to any of the sisters. Your goal is to identify the oldest sister and marry her.

Solution:
First task is to find the evil sister. This solution only works if evil sister knows whether she is going to lie or tell truth, compared to randomly answering yes or no without even listening to the question. The question we need to ask is: "If I ask you to use the opposite value when you are about to tell truth at the moment of answering my question, what will be your answer to: are you the evil daughter?". 
For older sister, the true answer to the hypothetical question is no, but since she is about to tell truth, she should give us the opposite value and answer yes.
For the younger sister the true answer to the hypothetical question is also no. Since she is going to lie, she should not use the opposite value, but she will lie and her answer will also be yes.
For the middle sister, the true answer to the hypothetical question is yes. If she decides to tell the truth, the opposite value and hence her answer will be no. If she decides to lie, she should not use the opposite value but since she is lying, her answer will be again no.
This question must be asked at least 2 sisters. If you hear no, it is the evil one. If both answers are yes, than the evil is the other sister. 
Then we need to ask something that we can verify. Since we already know who is the evil sister, we can ask any of the other two pointing to the right  direction: "Is she an evil sister?". Oldest will say yes, youngest - no.


Thursday, February 13, 2014

12 coins and scale

Imagine that you have 12 coins and a balance scales. You know that one of the coins is a counterfeit, but you don't know whether it is lighter or heavier than others. The task is to isolate the counterfeit coin with 3 weightings.

Solution:
Let's mark coins with letters A, B, C, D, E, F, G, H, I, J, K, L. The idea is to observe three different outcomes from the second and third weightings and apply them to three groups of coins. Group 1 is the coins that were removed from the scales, Group 2 that was moved to the opposite pan, Group 3 that stayed on the same pan. If the counterfeit coin is in Group 1, the scale will balance, if in Group 2, the scale will change position, if in Group 3, the scale will remain in the same position.
First weighting is with 4 coins on each pan: A, B, C, D - E, F, G, H. If the scales are in balance (a), the counterfeit coin is one of the four remaining coins I, J, K, L otherwise (b) it is one of the eight coins on the scales.
(a) For the second weighting we use A, I - J, K. If the scales are in balance, counterfeit is L and we can spend the third weighting to our pleasure. Otherwise, we weight J - K. If the scales are in balance, the counterfeit is I, if position of the scales stays the same as in prior weighting, it is K, if scales change position, it is J.
(b) Second weighting is: I, J, B, E - D, C, F, G. If scales are in balance, the suspects are A, H, which were removed from the scales (c). If scales are in the same position as in prior weighting, the suspects are B, F, G that stay on the same pans (d), if scales change position, the suspects are E, C, D, that were moved between pans (e)
(c) Third weighting is A - I. If the scales are in balance, the answer is H, otherwise A.
(d) F - G. If in balance, than B, if stay in the same position, then G, if change position, then F
(e) C - D. If in balance, than E, if same position, then D, if change position, then C

Monday, June 14, 2010

$1M в чемодане

Представим себе игру в которой игроку даётся возможность угадать в каком из 3-х совершенно одинаковых чемоданов спрятан 1М долларов. После того как игрок делает свой выбор но ещё не знает угадал он или нет, ведущий, который точно знает где лежит миллион, открывает один из оставшихся 2-х чемоданов в котором пусто и предлагает игроку либо оставить выбранный им чемодан, либо поменяться на тот, что ещё не открыт. Имеет ли смысл меняться?

Ответ:
Многие считают, что начальный выбор был сделан с вероятностью угадать миллион 1/3, а после того как один из оставшихся чемоданов был открыт, осталось только 2 чемодана, и значит если поменять своё решение, то выбор будет сделан с вероятностью 1/2. Они не учитывают тот факт, что принятие решение остаться с ранее выбранным чемоданом на этот момент имеет вероятность выигрыша тоже 1/2. Иначе говоря, после открытия пустого чемодана, шансы угадать миллион повысились до 1/2 для обоих оставшихся чемоданов. Менять решение не приносит преимущества.

Friday, May 21, 2010

Прямоугольный пирог с дыркой

У вас есть прямоугольлый пирог с капустой из которого кто-то уже вырезал прямоугольный кусок из произвольного места и съел. Надо разрезать то что осталось на 2 равные (по площади) части одним прямолинейным движением ножа. Есть 2 решения.

Решение 1:
Надо сделать разрез который проходит через центры обоих прямоугольников, пирога и дырки.

Решение 2:
Можно разресать пирог на 2 равных слоя по вертикали. В этом напрвлении пирог остался симметричным даже после вырезания прямоугольной дырки