| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:没有道理啊,数据都过了,我用的VECTOR<STRING>怎么会不对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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator