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

Posted by knightyau at 2011-02-26 16:11:47 on Problem 1028
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<fstream>
using namespace std;
int main()
{
	string a;
	int position =0;
	ifstream fin("input.txt");
	vector<string>v;
	v.push_back("http://www.acm.org/");
	while(fin >> a)
	{
		if(a=="QUIT")
		break;
		if(a=="VISIT")
		{
			position++;
			string b;
			fin >> b;
			v.insert(v.begin()+position,b);
			int s=1;
			while(position!=v.size()-1)
			{
				v.erase(v.begin()+position+s);
				s++;
			}
			cout << b << endl;
		}
		if(a=="BACK")
		{
			position--;
			if(position==-1)
			{
				position++;
				cout << "Ignored" << endl;
			}
			else
			cout << v[position] << endl;
		}
		if(a=="FORWARD")
		{
			position++;
			if(position==v.size())
			{
				position--;
				cout << "Ignored" << endl;
			}
			else
			cout << v[position] << endl;
		}
	}
}

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