文章

2

粉丝

12

获赞

1

访问

931

头像
猴子报数 题解:
P1081 兰州大学/湖南大学机试题
发布于2023年9月13日 18:59
阅读数 528

#include<stdio.h>
#include<malloc.h>
struct node{
    int num;
    struct node *next;
};
int n,s,m;
struct node *create(){
    struct node *head,*pre,*now;

    for(int i=1;i<=n;i++){
        now=(struct node*)malloc(sizeof(struct node));
        if(i==1){
            head=now;
            pre=now;
        }
        now->num=i;
        now->next=head;
        pre->next=now;
        pre=now;
    }
    return head;
};
void print(struct node *head){
    int i=1;
    struct node *p=head;
    s=s-1;
    while(s--){
        p=p->next;
    }
    while(p!=NULL){
        if(p->...
登录查看完整内容


登录后发布评论

暂无评论,来抢沙发