#include<stdio.h>
const int TOTAL=13;
const int INIT=1;
const int COUNT_NUM=3;
struct List
{
int num;
int killed;
struct List*next;
};
int main()
{
struct List*man=(struct List*)malloc(sizeof(struct List)),*p,*_p;
int i=1;int remained=TOTAL;
man->num=1;man->next=NULL;man->killed=0;p=man;
while(++i<=TOTAL)
{
_p=(struct List*)malloc(sizeof(struct List));
_p->num=i;_p->killed=0;_p->next=NULL;
p->next=_p;
p=_p;
}
p->next=man;
i=1;p=man;
while(remained>1)
{
p=p->next;
if(!p->killed)
{
i=i==3?1:i+1;
if(i==3)
{
remained-=(p->killed=1);
}
}
}
p=man;
while(p->killed) p=p->next;
printf("剩下了:%d号",p->num);
return 0;
}