# The mad king and the 100 men who each have to guess the colour of their own hat [duplicate]

The following is the puzzle that I am trying to figure out. I know the "expected solution of 99". But honestly, I think this puzzle is flawed. How exactly can each wise man know the number of hats saved if they died silently? Doesn't make sense to me.

A stark raving mad king tells his 100 wisest men he is about to line them up and place either a red or blue hat on each head. Once lined up, they must not communicate amongst themselves nor attempt to look behind them nor remove their own hat.

The king tells the wise men that they will be able to see all the hats in front of them. They will not be able to see the color of their own hat or the hats behind them, although they will be able to hear the answers from all those behind them.

The king will then start with the wise man in the back and ask "what color is your hat?" The wise man will only be allowed to answer "red" or "blue," nothing more. If the answer is incorrect then the wise man will be silently killed. If the answer is correct then the wise man may live but must remain absolutely silent.

The king will then move on to the next wise man and repeat the question.

Before they are lined up, the king makes it clear that if anyone breaks the rules then all the wise men will die. The king listens in while the wise men consult each other to make sure they don't devise a plan to communicate anything more than their guess of red or blue.

What is the maximum number of men they can be guaranteed to save?

• I am looking at the other answers. It doesn't work because in order for the people to know the parity, they would need to know if the person died behind them. BUT THEY WERE KILLED SILENTLY! So the first guy's hat is never known, regardless of whether he dies or not. If he dies silently, how is the person in front of him supposed to know? Dec 29, 2014 at 19:38
• It doesn't matter if the first guy lives or dies. His only job is to get the information about the hats to the others. After that, each person should correctly remain alive. Dec 29, 2014 at 19:40
• @StreamingBits, the prisoners are not silent: each prisoner passes information forward by saying their guess.
– A E
Dec 29, 2014 at 19:40
• @StreamingBits, you're right, the first person can't see his own hat. The first prisoner has no way of knowing. If placed in this situation, try to avoid being at the back of the line.
– A E
Dec 29, 2014 at 19:44
• – A E
Dec 29, 2014 at 19:46