/*
file:osephu.cpp author:www.5dkx.com
*/
#include <iostream>
using namespace std;
typedef struct Node{
int sort;
struct Node *next;
}Link,*List;
int Init(List *p); //初始化双链表
int Insert(List *p,int key); //插入节点
void Print(List p); //打印双链表
void CreateOsep(List p,int n); //初始化约瑟夫环void osehup(List p,int m,int len,List Re); //计算约瑟夫环出列顺序,并存放在Re链表中
int main()
{
int m,n;
List p,Re;
Init(&p);
Init(&Re);
cout<<"输入环大小: ";
cin>>n;
cout<<"输入地几个人出列: ";
cin>>m;
CreateOsep(p,n);
cout<<"输入为: "<<endl;
Print(p);
osehup(p,m,n,Re);
cout<<"出队顺序为:"<<endl;
Print(Re);
return 1;
}