[求助]带表头附加结点求职约瑟夫问题






算法要求以N,M和S(假定从第S个人开始第一次报数)作为值参。
#include<stdio.h>
struct suzu{
int n;
suzu *next;
};
void main(){
int num,point=0; //point计数器
suzu *p1,*p2,*head,*head1;
printf("输入人数:");
scanf("%d",&num);
head=p1=(struct suzu *)malloc(sizeof(struct suzu));
p1->n=1;
for(int i=2;i<=num;i++){
p2=(struct suzu *)malloc(sizeof(struct suzu));
p2->n =i; //申请空间和定位人
p1->next=p2;
p1=p2;
}
p1->next=null; //声明无后续
while(head->next!=null){
//游戏运行区,将脱节的结点接到head1上面去
}
//输出head1链表值
}
有急事,不写了,呵,有空再填上