/*************************************************************************
> File Name: JosephCirle.c
> Author: Wenfei6316
> Mail: [email protected]
> Created Time: 2018年06月18日 星期一 09时42分28秒
************************************************************************/
/*约瑟夫环说明:N(N>1) 个人组成一圈,从第 num 个人开始报数(从 1 开始报数)
*当谁报到数字 count 时将执行枪决,然后继续从后面一位开始接着循环,
*直到最后只剩下一个人,利用单向循环链表模拟出每次被杀的人以及最后存活的人*/
#include
#include
#include
typedef enum{false, true}bool;
typedef int data_t;
typedef struct Node
{
data_t data;
struct Node *next;
}JosephNode, *JosephLise;
JosephLise CreateList(int num);
void PrintList(JosephLise cyclelist);
void KillGame(JosephLise cyclelist, int num, int killer);
int main(int argc, const