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

WA到吐血,求大神解救,测试并没有发现什么问题啊

Posted by Saleed at 2016-08-26 10:55:57 on Problem 1028
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main(){
	vector<string> data;
	//vector<string> out;
	string in;
	data.push_back("http://www.acm.org/");
	int i=0;
	int in_num=0;
	while(cin>>in&&in!="QUIT"){
		if(in=="FORWARD"){
			if(i+1>=data.size()) cout<<"Ignored"<<endl;
			else cout<<data[++i]<<endl;
		}
		else if(in=="BACK"){
			if(i<=0) cout<<"Ignored"<<endl;
			else cout<<data[--i]<<endl;
		}
		else if(in=="VISIT"){
			for(int j=i+1;j<data.size();j++){	
				data.pop_back();
			}
			int size=data.size();
			for(int j=i+1;j<size;j++){	
				data.pop_back();
			}

			cin>>in;
			data.push_back(in);
			cout<<data[++i]<<endl;
		}
		else;
		in_num++;
		if(in_num>=100) return 0;
	}
	return 1;	
}

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