Let n = number of current on switches, and a = n mod 15.If a is odd,turn on (15-a)/2 switches and turn off (15+a)/2 switches. If a = 0, turn off 15 switches. If a is even and > 0, turn on 7 and turn off 8 so it becomes odd. Are there really bad prisoners that should not be released? If so, we change the rule to 14 switches every prizoner, but turn on an odd number of lights at the beginning. :) |
In the first round, the prisoners enter the room and change the statuses of the lights following this simple rule: shut off a light whenever possible. Then everybody can predict the process, and after this round, everybody know the current number of lights that are on. Then now we have simplified the problem. There are many algorithms to finish the work. The worst one might be this: in every round, the total effect is to shut off one light People of odd numbers shut off lights, and the others turn on lights). This method would keep the poor prisoners in the prison for aquite a long time (985*15 days, which is roughly 42 or 43 years). |
Using you method, in at most 68 days, all of them can be released!! |
Probabilty you think they deserve to stay there longer, you give them hope but let them be patient. |
欢迎光临 珍珠湾ART (http://zzwav.com/) | Powered by Discuz! X3 |