文章
17
粉丝
148
获赞
5
访问
194.9k
 
#include <iostream>
using namespace std;
typedef struct Node{
    int num;
    struct Node * next;
};
int main(void){
    int N; cin >> N;
    Node * pre=new Node, *head=new Node;
    pre=head;
    //创建链表
    for(int i=1;i<=N;i++){
            Node *node = new Node;
            node->num=i;
            pre->next = node;
            
            pre = pre->next;
    }
    pre->next=head->next;
    //删除一部分节点
    while(N!=1){
        for(int i=0;i<2;i++) head=head->next;
        No...
登录后发布评论
暂无评论,来抢沙发