文章
3
粉丝
414
获赞
5
访问
9.6k
#include "bits/stdc++.h"
#include
#include
#include
using namespace std;
#define NUM 3
struct Node {
int id;
struct Node *next;
Node(int x) : id(x), next(NULL){};
};
struct Node* createLink(int n){
struct Node *cur, *pre = NULL;
struct Node *head = new Node(1);
cur = head;
for (int i = 2; i <= n; i++){
struct Node *temp = new Node(i);
cur->next = temp;
cur = cur->next;
pre = temp;
}
pre->next = head;
return head;
}
int playGame(struct Node *head){
struct Node *startNode = head; // 下一次开始传花的人
struct Node *cur; // 接到花的人
struct Node *pre; // 接到花的人的前一个人
&n...
登录后发布评论
暂无评论,来抢沙发