This is a puzzle question ....

The warden meets with 23 new prisoners when they arrive. He
tells them, "You may meet today and plan a strategy. But
after today, you will be in isolated cells and will have no
communication with one another.

"In the prison is a switch room, which contains two light
switches labeled A and B, each of which can be in either the
'on' or the 'off' position. I am not telling you their
present positions. The switches are not connected to anything.

"After today, from time to time whenever I feel so inclined,
I will select one prisoner at random and escort him to the
switch room. This prisoner will select one of the two
switches and reverse its position. He must move one, but
only one of the switches. He can't move both but he can't
move none either. Then he'll be led back to his cell.

"No one else will enter the switch room until I lead the
next prisoner there, and he'll be instructed to do the same
thing. I'm going to choose prisoners at random. I may choose
the same guy three times in a row, or I may jump around and
come back.

"But, given enough time, everyone will eventually visit the
switch room as many times as everyone else. At any time
anyone of you may declare to me, 'We have all visited the
switch room.' and be 100% sure.

"If it is true, then you will all be set free. If it is
false, and somebody has not yet visited the switch room, you
will be fed to the alligators."

What is the strategy they come up with so that they can be free?

Answer Posted / adrian may

They all have to signal twice, because the first signal the
caller sees might just have been that the warden left the
switch on to begin with. In that case he'll see 45
altogether if he waits long enough. But maybe the switch
was off to begin with and he only gets 44. If one prisoner
had never been in, the most the caller could see is 43. If
each prisoner only signals once, you can't tell if somebody
is still waiting when you see 22.

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

is it possible to learn sap from book without any tutorial. if yes please mention the beginner,s book of sap and also make your valuable advice for self study of sap .

1649


Hi guyes, I have cleared 2 technical rounds with cts for liferay and java techonologies, i have client round next week, please tell me how to prepare for this what questions i should be ready to face?

3484


What is dialog programming?

1667


how to convert hashmap to arraylist with iteration

1292


how pseudo column works?

1823






what are the topics choosen for jam round for interviews

1267


they asked me about srs (software requirement specifcation)? how can i get anydocumentation about srs & other documnts infomation like bdd, in testing? its urgent?

1548


through which algorithm does the garbage collector works? how the garbage collector will understand that the object will going to be deleted?

2176


I am taking the bmc control m/enterprise manager 7.0 scheduling test and just wanted to see what kind of questions they would ask or if anyone has taken the test and how long it is for how many questions?

5752


what is the software to run the GSM gate opener program

1766


there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box. eg: 3 box contain stick as:1,1,1. if u take 1 stick from 3rd numbred box you will any how win the match.

2519


how to hide prompts

1529


how can i create report in abap to insert data in table pa0002 using insert command

1823


hi, all this is shoba m.c.a . i have learned abap but no oppurtunities right now as fresher , right now i want to learn any course on demand any one pls suggest me good course and institute in hyderabad

1483


what is meant by life cycle of a business

1793