| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
这RE得蛋疼菊紧#include<stdio.h>
#include<malloc.h>
struct ch
{
char name[100];
struct ch *next;
};
int main()
{
int N=0,i=0,w=0,s=0,j=0;
struct ch *p=NULL,*head=NULL,*NEW=NULL,*q=NULL;
scanf("%d",&N);
for(i=0;i<N;i++)
{
NEW=(struct ch *)malloc(sizeof(struct ch));
scanf("%s",&NEW->name);
if(p==NULL)
{
head=NEW;
p=NEW;
}
else
{
p->next=NEW;
p=NEW;
}
}
p->next=head;
scanf("%d,%d",&w,&s);
p=head;
for(i=1;i<w;i++)
{
p=p->next;
}
q=p;
for(i=0;i<N;i++)
{
for(j=1;j<s;j++)
{
q=p;
p=p->next;
}
printf("%s\n",p->name);
q->next=p->next;
free(p);//加了这句就RE,删了就AC
p=q->next;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator