A7: a) Ten prisoners are in a bad situation. Tomorrow, the prison warden will randomly arrange them in a line, facing towards one end of the line, and put a red or blue hat on each. Each will see the hats of those in front, but not of those behind or on his own head. One by one, starting at the back of the line and moving forward, the warden will ask each the color of his own hat. Each prisoner must answer, and if he will live if and only if he answers correctly.
Tomorrow the prisoners may not talk to each other, though they will hear the answers to the warden’s questions. But tonight they can discuss and devise a strategy to maximize the number of people who will live tomorrow. What is the best strategy and how many will it save?
b) Now suppose there are N colors for the hats and answer the same question.
I have been working on it and have reached the following conclusion: Say the color of the person who is in front of you. Say the color of the person in front of you. Whether your wrong or right, at least the person in front of you will know what color his is. Then he can say what his color is although it may not be the same as the one in front. Therefore, $5$ are sure to be saved. The other $5$ have a $50$% chance of being saved. How does this answer sound?