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:哪位大神替我看看为什么不能ACIn Reply To:哪位大神替我看看为什么不能AC Posted by:1404114631 at 2015-05-23 00:16:23 > #include<iostream> > #include<string> > #include<stack> > using namespace std; > int main() > { > stack<string>fostack,bastack; > string s,page,curpage; > int i; > curpage="http://www.acm.org/"; > while(cin>>s,s[0]!='Q') > { > if(s[0]=='V') > { > cin>>page; > bastack.push(curpage); > curpage=page; > cout<<curpage<<endl; > if(!fostack.empty()) > { > for(i=0;i<fostack.size();i++) > fostack.pop(); > } > } > if(s[0]=='B') > { > if(!bastack.empty()) > { > fostack.push(curpage); > curpage=bastack.top(); > bastack.pop(); > cout<<curpage<<endl; > } > else > cout<<"Ignored"<<endl; > > } > if(s[0]=='F') > { > if(!fostack.empty()) > { > bastack.push(curpage); > curpage=fostack.top(); > fostack.pop(); > cout<<curpage<<endl; > } > else > cout<<"Ignored"<<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