Problems 21  30
21) The
Prisoners and the Hats The warden of the Arizona State Penitentiary decides to have some fun one day... he decides he will give three prisoners a chance to go free... but only if they can prove themselves worthy of being released! The warden brings out five hats, three of them red and two of them blue. The three prisoners are then blindfolded and one of the hats, at random, is placed on each of their heads. He lines up each prisoner in a row, facing a brick wall. The blindfolds are then removed. Prisoner C can see both Prisoners A and B and the color hats that each of them is wearing. Prisoner B can only see Prisoner A and his hat. Prisoner A, being in the front, cannot see any hats. And no prisoner can, of course, see the color of his own hat. 
The problem he puts to the prisoners
is simple: "If you can determine the color of the hat on your own head, I will release you from this prison. If you answer incorrectly, I will add another 20 years to your sentence! However, if you do not know and choose not to answer at all, nothing will come of it." He first asks Prisoner C, "What is the color of the hat on your head?" Prisoner C thinks for a short while and then replies, "I'm sorry, I do not know." He then asks Prisoner B, "What is the color of the hat on your head?" Prisoner B thinks for a short while and then also replies, "I'm sorry, I do not know." He finally asks Prisoner A, "What is the color of the hat on your head?" Prisoner A thinks for a short while and then replies, "I know! The color of my hat is...." What color hat is Prisoner A wearing and how did he know? 
22) The
Three Suspects Kyle, Neal, and Grant were rounded up by their mother yesterday, because one of them was suspected of having grabbed a few too many cookies from the cookie jar. The three brothers made the following statements under very intensive questioning:
If only one of these statements was true, who took the cookies? 
23) The
Three Switches In your basement are three light switches, all of them currently in the OFF position. Each switch controls one of three different lamps on the floor above. You would like to find out which light switch corresponds to which lamp. You may move turn on any of the switches any number of times, but you may only go upstairs to inspect the lamps just once. How can you determine the switch for each lamp with just one trip upstairs? 
24) The
Combs in the Hats Imagine that you have three hats, one containing two black combs, one containing two white combs, and the third containing one black comb and one white comb. The hats were originally labeled for their contents (BB  WW  BW) but someone has inadvertently switched the labels so that now every hat is incorrectly labeled! Without looking inside, you are allowed to take one comb at a time out of any hat that you wish, and by this process of sampling, you are to determine the contents of all three hats. What is the smallest number of drawings needed to do this? 
25) The
Girls, the Balls, and the Boxes Four girls were blindfolded and each was given an identical box, containing different colored balls. 

Each box had a label on it reading
"BBB" (Three Black) or "BBW" (Two
Black, One White) or "BWW" (One Black, Two
White) or "WWW" (Three White). The girls were
told that none of the four labels correctly described the
contents of the box to which it was attached. Each girl was told to draw two balls from her box, at which point the blindfold would be removed so that she could see the two balls in her hand and the label on the box assigned to her. She was given the task of trying to guess the color of the ball remaining in her box. As each girl drew balls from her box, her colors were announced for all the girls to hear but the girls could not see the labels on any boxes other than their own. The first girl, having drawn two black balls, looked at her label and announced: "I know the color of the third ball!" The second girl drew one white and one black ball, looked at her label and similarly stated: "I too know the color of the third ball!" The third girl withdrew two white balls, looked at her label, and said: "I can't tell the color of the third ball." Finally, the fourth girl declared: "I don't need to remove my blindfold or any balls from my box, and yet I know the color of all three of them. What's more, I know the color of the third ball in each of the other boxes, as well as the labels of each of the boxes that you have." The first three girls were amazed by the fourth girl's assertion and promptly challenged her. She proceeded to identify everything that she said she could. Can you do the same? 
26) A MasterMind Puzzle
(2) Solve the hidden code. (Note: Regular MasterMind conditions apply:

27) Four Gallons of Water 
Using just a 5gallon bucket and a 3gallon bucket, can you put four gallons of water in the 5gallon bucket? (Assume that you have an unlimited supply of water and that there are no measurement markings of any kind on the buckets.) 
28) Find the Fake Coins 
Here are ten moneybags each
filled with a large number of coins. (Some bags may
contain more coins than others.) All the coins look
exactly alike, but those in one of the bags are actually
all counterfeit! Each real coins weighs an "integral" number of grams (the weight can be expressed as an integer  a whole number) while the counterfeit coins weigh exactly one gram less than a real coin. You have a gram scale handy but you are only permitted to use it one time! How do you determine with just a single weighing, not only which bag has the counterfeit coins, but the number of grams a coin weighs? 
29) The Balanced Family Paul and Teri Newlywed are planning a family. They've decided that they would like to have four children; no more no less. They really don't want all four boys or all four girls but would prefer to have more of a balanced brood. Once again, assuming a 5050 chance for a boy or a girl, are they more likely to end up with... 1)
two boys and two girls or 
30) The Three Coins You have three coins in a bag. One is a regulation coin with "heads" on one side and "tails" on the other. The two other coins are counterfeit: one has heads on both sides and the other has tails on both sides. Give the bag a good shaking, withdraw one coin at random and lay it on the table without looking at the down face. The up face is a heads. What is the probability the down face is tails? 