#include<stdio.h> typedef struct DuLNode { int data; struct DuLNode *prior; struct DuLNode *next; }DuLNode,* DuLinkList; void ListDelete(DuLinkList &L,DuLNode *p,int &e) { e=p->data; p->prior->next=p->next; p->next->prior=p->prior; delete p; } int main() { int n,i; scanf("%d",&n); DuLinkList p=new DuLNode; DuLinkList L=p; for(i=0;i<n;i++) { DuLinkList s=new DuLNode; s->data=i; s->prior=p; p->next=s; p=s; L->prior=p; p->next=L; } int e; DuLinkList t=L->next->next->next; ListDelete(L,t,e); p=L->next; for(i=0;i<n-1;i++) { printf("%d ",p->data); p=p->next; } printf(" "); return 0; }