求助呜呜呜,全RE可能什么问题呀,下载第一个数据点本地跑了跑没啥问题
查看原帖
求助呜呜呜,全RE可能什么问题呀,下载第一个数据点本地跑了跑没啥问题
182596
T_FOUNTAIN楼主2020/8/4 20:08
#include<stdio.h>
#include<stdlib.h>

struct per{
    struct per *nxt;
    struct per *prev;
    int num;
};

void main(){
    int i,n,m;
    scanf("%d %d",&n,&m);

    struct per *p,*head;
    head = (struct per*)malloc(sizeof(struct per));
    p = head;
    head->nxt = NULL;
    head->prev = NULL;
    head->num = 1;

    for(i = 2;i <= n;i++){
        struct per *tmp = (struct per*)malloc(sizeof(struct per));
        tmp->prev = p;
        tmp->nxt = NULL;
        tmp->num = i;
        p->nxt =tmp;
        p = tmp;
    }
    p->nxt = head;
    head->prev = p;
    p = head;

    while(p->nxt!=p){
        for(i = 0;i < m-1;i++){
            p = p->nxt;
        }
        printf("%d ",p->num);
        p->prev->nxt = p->nxt;
        p->nxt->prev = p->prev;
        p = p->nxt;
    }
    printf("%d",p->num);
}

2020/8/4 20:08
加载中...