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:哪位大哥帮忙看一下!WA了n次。In Reply To:哪位大哥帮忙看一下!WA了n次。 Posted by:chenyy at 2007-07-30 17:00:55 VISIT 的时候没有把 forward 栈清空。 > #include<iostream> > using namespace std; > #include<string.h> > int main() > { > int n,i,p; > char h[200][75],str[20]; > strcpy(h[0],"http://www.acm.org/"); > i=0; > for(p=1;p<200;p++) > strcpy(h[p],"\0"); > while(scanf("%s",str)!=EOF) > { > if(strcmp(str,"QUIT")==0)break; > else if(strcmp(str,"VISIT")==0) > { > scanf("%s",h[++i]);puts(h[i]); > } > else if(strcmp(str,"FORWARD")==0) > { > if(strcmp(h[i+1],"\0")==0)printf("Ignored\n"); > else puts(h[++i]); > } > else if(strcmp(str,"BACK")==0) > { > if(i!=0){puts(h[--i]);} > else printf("Ignored\n"); > } > } > return 0; > } > > Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator