#include<stdio.h> #include<stdlib.h> typedef struct num { int num; struct num *next; }link; void create(int n) { link *head,*node,*end; head =(link*)malloc(sizeof(link*)); end =head; for(int i=1;i<=n;i++) { node=(link*)malloc(sizeof(link*)); scanf("%d",&node->num); end->next=node; end=node; } end =head->next; int count; link *news =(link*)malloc(sizeof(link)); link *r=end->next; link *l=end; link *now=head; now->next =r; l->next =r->next; r->next=l; end=head; for(int i=0;i<n-2;i++) { end=end->next; } now=end; l =end->next; r=end->next->next; now->next =r; l->next=r->next; r->next=l; end=head->next; while(end!=NULL) { printf("%d ",end->num); end=end->next; } } int main() { int n; scanf("%d",&n); create(n); return 0; }