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

help~~谁来救救我啊……

Posted by cwj at 2010-05-06 21:21:01 on Problem 1028 and last updated at 2010-05-10 22:36:12
各位路过的高手~~帮帮我啊~~咋总是wa呢~~不胜感激
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string a[500];
	string b,d;
	int k=0;
	a[0]="http://www.acm.org/";
	while(cin>>b&&b!="QUIT")
	{
		if (b=="VISIT") 
		{
			cin>>d;
			a[++k]=d;
			cout <<a[k]<<endl;
		}
		else 
		{
		if (b=="BACK"&&k>1)
			cout <<a[--k]<<endl;
		else 
			if (b=="BACK"&&k==1)
				cout <<a[--k]<<endl;
		else 
			if (b=="FORWARD"&&a[k+1][0]!=NULL)		
			cout <<a[++k]<<endl;
		else cout << "Ignored"<<endl;
		}
	}
	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