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
can we extend a class having only one parameterised constructor.Suggest the process to do it.
How does the type system works when there is interoperability between a COM and .Net, i mean what exactly happens there
Wrtite a JCL for sorting a file with start from 36 postion lenth 9 excluding a num eq to 98768. for 3 marks mainframe
could you please tell me how to draw the calibration curve for HPLC {the software which we are using}?
please any one pass file aid,xpeditor and endeavor tools
What is the difference between CLEAR & RESET and OPEN & CLOSE OPCOEDS(USING RPG/400).wheare we can use this?can any body tell me in real time senario with example please?
details description on this mantis? who is founder of this mantis?
Write a pascal program to calculate the sum of the first 100 even number and odd number
What's the difference b/w Table & Templete in Smartform?
Write a shell program to test whether a given year is leap year or not ?
9.Difference between even and odd signals?explain with the diagram?
what is the similarity between networking devices?
in a VB application, where the data will be stored after manipulation? what is the syntax for that?
Explain what is OOPS and its concepts?
Is anyone has done the ASP.NET MVC4 workshop course(2 days) from Peers Technologies. Let me know. I need to talk before joining ASP.NET MVC4 training at peers, Hyderabad.