文章

37

粉丝

67

获赞

3

访问

8.7k

头像
击鼓传花 题解:模拟过程即可
P1018 贵州大学机试题
发布于2024年3月5日 20:25
阅读数 326


#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
struct node {
    int data;
    struct node * next;
};

struct node* create(int n) {
    struct node *head=NULL,*q;
    for (int i = 1; i <=n; i++) {
        struct node *p = (struct node*)malloc(sizeof(struct node));
        p->data = i;
        if (head == NULL) {
            head = p;
            p->next = head;
        }
        else {
            q = head;
            //尾插法
            while (q->next != head) {
  ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发