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 |
WA到吐血,求大神解救,测试并没有发现什么问题啊#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator