Problem 47668. A KING AND 100 PRISONERS
Solution Stats
Problem Comments
-
3 Comments
Nice. On the other hand, the test suite should probably forbid people from returning any number between 20 and 40. Just open the file and look for these numbers and their multiples explicitly.
And by the way, it would be faster if all prisoners could turn off the light. They only need to have a variable known by all who share the room but the king. Leave the king doubtful and in the dark, so they would all go free.
On top of what Rafael said, "20 <= prisoners <= 40" does not do what you apparently think it does.
Solution Comments
Show commentsProblem Recent Solvers20
Suggested Problems
-
717 Solvers
-
find the roots of a quadratic equation
239 Solvers
-
Create the following sequence : 0 1 1 4 9 25 64 169 ...
202 Solvers
-
183 Solvers
-
497 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!