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

要死了,各位GG牛帮忙看看哪里WA了~~~~~~~

Posted by ReGeBe at 2010-03-27 13:06:24 on Problem 1028
要死了,各位GG牛帮忙看看哪里WA了~~~~~~~

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
int main(void)
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	vector<string> page;
	string temp;
	int i, pt = 0, rightRange = 1;
	page.push_back("http://www.acm.org");
	while(getline(cin, temp, '\n'))
	{
		if("QUIT" == temp)break;
		i = 0;
		if('V' == temp[0])
		{
			while(i < temp.length() && temp[i] != ' ')++i;
			++i;
			string dest = temp.substr(i, temp.length() - 1);
			++pt;
			if(pt == page.size())
				page.push_back(dest);
			else
				page[pt] = dest;
			cout << dest << endl;
			rightRange = pt + 1;	//设立标志,相当于把后面的网址清空
		}
		else if('B' == temp[0])
		{
			--pt;
			if(pt < 0)
			{
				cout << "Ignored" << endl;
				++pt;
			}
			else
				cout << page[pt] << endl;
		}
		else if('F' == temp[0])
		{
			++pt;
			if(rightRange <= pt)
			{
				cout << "Ignored" <<  endl;
				--pt;
			}
			else
				cout << page[pt] << 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