| ||||||||||
| 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 | |||||||||
要死了,各位GG牛帮忙看看哪里WA了~~~~~~~要死了,各位GG牛帮忙看看哪里WA了~~~~~~~
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
int main(void)
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
vector<string> page;
string temp;
int i, pt = 0, rightRange = 1;
page.push_back("http://www.acm.org");
while(getline(cin, temp, '\n'))
{
if("QUIT" == temp)break;
i = 0;
if('V' == temp[0])
{
while(i < temp.length() && temp[i] != ' ')++i;
++i;
string dest = temp.substr(i, temp.length() - 1);
++pt;
if(pt == page.size())
page.push_back(dest);
else
page[pt] = dest;
cout << dest << endl;
rightRange = pt + 1; //设立标志,相当于把后面的网址清空
}
else if('B' == temp[0])
{
--pt;
if(pt < 0)
{
cout << "Ignored" << endl;
++pt;
}
else
cout << page[pt] << endl;
}
else if('F' == temp[0])
{
++pt;
if(rightRange <= pt)
{
cout << "Ignored" << endl;
--pt;
}
else
cout << page[pt] << 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