Wolf Chasing rabbits
A rabbit hid in a 10-ring distribution of the hole in one of the wolf in the first hole did not find the rabbit, on the other hole, to the third hole to find, also did not find, on the two holes, to the sixth hole to find, after each one more hole to find rabbits ... This way, if you have not found the rabbit, may I ask the rabbit in which hole?
The order of the wolves looking for holes: first: 1; second: 3; third 6; fourth time: 10; fifth time: 5 ...
Clever conversion of the problem:
In which hole is the rabbit safe? "---equivalent---" What hole will wolves go for?
The wolf can not find the rabbit, then the infinite time to go on.
The 21st time the Wolf returned to the 1th hole, after that is repeated, the infinite is due to 21 times is enough.
#include <stdio.h>void main () {bool hole[11]={0};//10 hole int Pos=1; for (int i=1;i<21;i++)//21st time The Wolf returned to the 1th hole {hole[pos]=true; The wolf has looked for the hole pos+=i+1; pos=pos%10; } for (int i=1;i<10;i++) if (!hole[i]) printf ("Rabbit may be in the hole in section%d \ n", i);}
The answer is: 2, 4, 7, 9 The safest, the wolf can not find
Wolf Chasing rabbits