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
what are all the ant command options
How to get the index of the clicked field in reports in ABAP?
What is the first message line that any language learning prints on the screen? and why?
what is the difference between an OS(operating system) and Framework?
19. Given a system that is described with the following equation, X=A+(B.(A̅+C)+C)+A.B.(D̅+E̅) a) Simplify the equation using Boolean Algebra. b) Implement the original and then the simplified equation with a digital circuit. c) Implement the original and then the simplified equation in ladder logic.
Hey this is venkatesh.Please can any body tell me what is SFLNXTCHG?where we use this keyword?what perpuse we use this?Can you tell me in real time senario with example? And in 7 specification(RPG/400)what is the mandatory specification using programs?
Write a program to swap the content of two variables without using a third variable.
I want to pass .pdf files as OlE Object to crystal report through VB6. Please any one guid me...
How to connect to ms word wit VB ojective is to prepare s/w to generate question paper , selects questions randomly from the ms access , database
1. Write a program to create a sentence at runtime and count number of vowels in it ? 2. Write a program to get a string and to convert the 1st letter of it to uppercase ?
differences between qtp10.0 and 11.0 ?
what is integration testing in real time applications?
Diffrence between 2.0,3.0,3.5,4.0. versions of .net?
what is programmable BIST in today ic design
pleasew define carrier scope in abap (sap).