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啊?

Posted by bhq at 2009-03-21 22:35:16 on Problem 1028
In Reply To:哪位牛人帮我看看啊,怎么老WA啊? Posted by:0710321109 at 2009-02-24 23:16:14
这样……
#include < iostream >
#include < string >
using namespace std ;

int main ( )
{
	string order , url[100] ;
	url[0] = "http://www.acm.org/" ;
	cin >> order ;
	for ( int i = 0 , j = 0 ; order != "QUIT" ; cin >> order )
	{
		if ( order == "VISIT" )
		{
			i++ ;
			j = i ;
			cin >> url[i] ;
			cout << url[i] << endl ;
		}
		if ( order == "BACK" && i - 1 >= 0 )
		{
			i-- ;
			cout << url[i] << endl ;
			continue ;
		}
		if ( order == "BACK" && i <= 0 )
		{
			cout << "Ignored" << endl ;
		}
		if ( order == "FORWARD" && i + 1 <= j )
		{
			i++ ;
			cout << url[i] << endl ;
			continue ;
		}
		if ( order == "FORWARD" && i >= j )
		{
			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