#include<stdio.h>
void main(void)
{
int i,test,p[17],head;
for(i = 0; i < 16; i++)
p[i] = i + 1;
p[16] = 0;
test = 0;
while(test != p[test])
{
for(i = 1; i < 3; i++)
{
head = test;
test = p[test];
}
p[head] = p[test];
test = p[head];
}
printf("\n%5d",test);
return;
}
17人逢3的倍数就离开的,然后继续报数,只到最后一人留下来的题目的答案,但本人实在看不明白,求高手大虾指点!~
循环体内很难理解。~~