#include <stdio.h>
#include <stdlib.h>
#define N 14
struct circle{
int num;
struct circle *next;
};
int main () {
struct circle *head;
struct circle *p1,*p2;
int n=1;
p1=p2=(struct circle *)malloc(sizeof(struct circle));
p1->num=1;
while(p1->num!=N+1){
if(n==1){
head=p1;
}else{
p2->next=p1;
}
p2=p1;
p1=(struct circle *)malloc(sizeof(struct circle));
n++;
p1->num=n;
}
p2->next=head;
p1=head;
for(int i=0;i<N;i++){
printf("%d\n",p1->num);
p1=p1->next;
}
p1=head;
int sum=0;
for(int j=0;j<N-1;){
if(p1->num!=0){
sum++;
}
if(sum==3){
p1->num=0;
j++;
sum=0;
}
p1=p1->next;
}
while(p1->num==0){
p1=p1->next;
}
printf("最后剩下的数为%d",p1->num);
return 0;
}