21) The Prisoners and the Hats

There are seven possible ways the five hats could be distributed among the three prisoners:

  1 2 3 4 5 6 7
Prisoner A R R R R B B B
Prisoner B R R B B B R R
Prisoner C R B R B R B R

 

There are only two blue hats so if the 5th scenario occurred, Prisoner C would see the two blue hats on each of the other two prisoners and would then know his hat must indeed be red. But since Prisoner C told the warden he didn't know the color of his own hat, this scenario did not occur.

  1 2 3 4 5 6 7
Prisoner A R R R R B B B
Prisoner B R R B B B R R
Prisoner C R B R B R B R

 

If either the 6th or the 7th scenario occurred, Prisoner B would know he must have a red hat on! Prisoner B would see the blue hat on Prisoner A and knowing if he himself had a blue hat on, Prisoner C would have seen this and deduced that he himself (Prisoner C) could only have a red hat on! But prisoner C didn't do that and since Prisoner B also told the warden he did not know the color of his hat, these two scenarios did not occur either.

  1 2 3 4 5 6 7
Prisoner A R R R R B B B
Prisoner B R R B B B R R
Prisoner C R B R B R B R

 

There are only four possibilities left and each one of them has Prisoner A with a red hat! So Prisoner A told the warden such and was released! (It is not possible to determine the color of the hats for the other two prisoners.)

 

(Thanks to my old friend, Fred Jarmuz for this puzzle.)