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

哪位大神替我看看为什么不能AC

Posted by 1404114631 at 2015-05-23 00:16:23 on Problem 1028
#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:
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