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:哪位大哥帮忙看一下!WA了n次。

Posted by asterix314 at 2007-08-28 21:54:04 on Problem 1028
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:
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