文章

70

粉丝

0

获赞

222

访问

6.5k

头像
击鼓传花 题解:C
P1018 贵州大学机试题
发布于2026年3月19日 20:18
阅读数 96

#include<stdio.h>
#include<malloc.h>

typedef struct Node{
    int numb;
    struct Node * Next;
}Node;


Node * create_link(int n){
    Node * head = (Node*)malloc(sizeof(Node));
    head->Next = head;
    head->numb = 1;

    Node * q = head;
    for(int i=2; i<=n; i++){
        Node * p = (Node*)malloc(sizeof(Node));
        p->Next = head;
        p->numb = i;
        q->Next = p;
        q = q->Next;
    }
    return head;
}


int search_last(Node * head){
    Node * q = head;
    int count=1;
    while( q->Next!=q ){
        count++;
     ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发