Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:平生第一个指针 AC 0ms

Posted by 385315007 at 2011-09-05 23:53:00 on Problem 3750
In Reply To:平生第一个指针 AC 0ms Posted by:comzyh at 2010-10-27 20:25:29
> 为了练指针而练指针。
> 
> #include <cstdio>
> #include <cstring>
> #include <cstdlib>
> struct Node{
>        char str[100];
>        Node *next,*pre;
>        };
> int N,W,S;
> Node *head,*tail,*t;
> inline void del(Node *x);
> int main(){
>     int i,j;
>     scanf("%d%*c",&N);
>     head=new Node;
>     tail=head;
>     for (i=1;i<=N;i++){
>         gets(tail->str);
>         tail->next=new Node;
>         tail->next->pre=tail;
>         tail=tail->next;
>         }    
>     tail->pre->next=head;
>     head->pre=tail->pre;
>     scanf("%d,%d",&W,&S);
>     t=head;
>     for (i=1;i<W;i++)
>         t=t->next;
>     for (t=t;t->next!=t;0){
>         for (i=1;i<S;i++)
>             t=t->next;
>             puts(t->str);
>             t=t->next;
>             del (t->pre);
>             }
>     puts(t->str);
>     system("pause");
>     }
> inline void del(Node *x){
>        x->next->pre=x->pre;
>        x->pre->next=x->next;
>        delete x;
>        }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator