http://www.quantnotes.com/edutainment/intermediate/hatproblem.htm
Q
:: Hat Problem ::
100 prisoners are given the chance to be set free tomorrow. They are all told that they will each be given a hat to wear and that they cannot see the colour of the hat assigned to them. They know that there are 3 possible colours of hat: red, blue, and white. Each prisoner can see everyone else's colour hat except their own. The hats colours are assigned completely at random and once the hats are placed on top of each prisoner's head they cannot communicate with others in any form, or else they are immediately executed. The prisoners will be called out in random order and they are to guess the colour of the hat that he/she is wearing. They shout the colour of the hat so that everyone else can hear. If the prisoner guesses correctly the colour of his/her hat they are set free immediately, otherwise executed.
They are given the night to come up with a strategy amongst themselves to save as many prisoners as possible. What is the best strategy they can adopt and how many prisoners can they guarantee to save? (Hint: Start with the case where there are only 2 possible colour hats).
UQ

Q
:: Hat Problem ::
100 prisoners are given the chance to be set free tomorrow. They are all told that they will each be given a hat to wear and that they cannot see the colour of the hat assigned to them. They know that there are 3 possible colours of hat: red, blue, and white. Each prisoner can see everyone else's colour hat except their own. The hats colours are assigned completely at random and once the hats are placed on top of each prisoner's head they cannot communicate with others in any form, or else they are immediately executed. The prisoners will be called out in random order and they are to guess the colour of the hat that he/she is wearing. They shout the colour of the hat so that everyone else can hear. If the prisoner guesses correctly the colour of his/her hat they are set free immediately, otherwise executed.
They are given the night to come up with a strategy amongst themselves to save as many prisoners as possible. What is the best strategy they can adopt and how many prisoners can they guarantee to save? (Hint: Start with the case where there are only 2 possible colour hats).
UQ