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:没有道理啊,数据都过了,我用的VECTOR<STRING>怎么会不对

Posted by earthquake at 2008-04-12 17:14:11 on Problem 1028
In Reply To:Re:没有道理啊,数据都过了,我用的VECTOR<STRING>怎么会不对 Posted by:earthquake at 2008-04-12 17:14:04
#include<iostream>
#include<vector>
#include<string>
using namespace std;

int main(){
	int i=0,j=0,sum=0;
	vector<string> sb(1000);
	vector<string> sf(1000);
	sb[0]="http://www.acm.org/";
	string a;
	while(cin >>a&&a!="QUIT"){
		if(a=="VISIT"){
			cin >>a;i++;
			sb[i]=a;
			sf[j]=a;j++;
			if(sum<=j) sum=j;
			cout <<a<<endl;
		}
		else if(a=="BACK"){
            i--;j--;
			if(i<0) {cout<<"Ignored"<<endl;i=0;}
			else cout<<sb[i]<<endl;
		}
		else if(a=="FORWARD"){	
			if(j<0) j=0;
			if(j>=sum) {cout<<"Ignored"<<endl;j=sum;}
			else {i++;sb[i]=sf[j];j++;cout <<sb[i]<<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