Quote:
Originally Posted by dhanu_25 hmm..i think 99 can be saved..one has to sacrifice his life for his fellas  ..the first one can call out the color of the hat of the second one..and so on..there is a 50% chances that first one also gets saved.. |
i think my solution has been overlooked. let me try to elaborate it this time.
let assume that there are 10 prisoners only. A,B,C,D,E,F,G,H,I and J in the order with A in front and J at last. let A,C,D,F,G and J have black caps on their head. and B,E,H and I have white caps.
now if they have decided that the last one will shout 'black' if there are even number of black caps before him else white, then
J - he will shout "WHITE" (J can see odd number of black caps before him excluding himself)
I - he'll count the number of black caps. since its odd he'll know that he is wearing white caps himself so he will shout white.
H - same as I
G - he'll count the number of black caps. since he can count 4 caps(even), he'll know that he is wearing black cap (because J, I and H have shouted white meaning odd number of black caps still remains including himself). so he'll shout 'black'
F - he'll count the number of black caps in front of him and the number of black caps that is already shouted (4 in all, even) so he should be wearing black cap. so he knows he should be wearing black cap because J shouted white meaning odd number of black caps. so he'll shout black.
and so on.. each will count the number of black caps in front of him and the number of black caps that is already shouted. and can very easily find the colour of the cap that he is wearing..