Around the top of the mountain there are 10 holes, a rabbit and a fox live in their own hole, the fox always want to eat rabbits, one day the rabbit said to the fox, you want to eat I have a condition, you first put the hole number 1 to 10, you start from the 10th hole, first to the 1th hole looking for me, the second every hole to find me, the third time two holes to find me And so on, and so on, if you can find me you can feast on a meal, not found before I can not stop, fox think only 10 holes, the number of search for unlimited, which can not find the truth, agreed to the conditions, the results of the Fox ran faint in the past also did not find rabbits, ask the rabbit to hide in which hole. The fox can be assumed to have been found 1000 times in the program.
The code is as follows:
#include <stdio.h>intMain () {inthole[Ten]={1,2,3,4,5,6,7,8,9,Ten};inti,j=0, index; for(i=0;i< +; i++) {J=j+i+2; Index=j%Ten; Hole[index]=1; } for(i=0;i<Ten; i++) { if(hole[i]!=1) printf ("Rabbit is at the hole%d\n", Hole[i]); }return 0;}
The results show that the Fox could not find her as long as the rabbit was in hole No. 2479.
C language to solve the fox's problem of finding rabbits