Why not just say the color of the hat for the person in front of you. The first person does not know the color of their hat and has a 50% chance of dieing, but every other person gets to know the color of their own hat and gets to live. KISS!
I don’t think that this works good. For example, if 100 is wearing a red hat, 99 a blue one and 98 a red one again. 100 will say ‘Blue’ and 99 repeats the same to save his life but he is supposed to say ‘Red” as 98 is wearing a red hat. So this also results in 50% success only.
You're right. It doesn't work.
number 100 will say red if the number of red is even, blue is the number of redd is odd. number 99 counts the red infront of him if it is the same evenness or oddness as the one before him then he knows he's blue other wise he know he's red, each of the next persons listens and calculates accordingly
Hope that is the solution given in the problem.
Fog Creek Home