⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 acm题解: Web Navigation 使用堆来解决
💻 CPP
字号:
#include <iostream>#include <vector>#include <string>

using namespace std;
int main()
{    string current = "http://www.acm.org/";    vector<string> back_history(0);    vector<string> forw_history(0);
    string line;    cin>>line;    while(line!="QUIT"){        if(line == "VISIT"){            cin>>line;            back_history.push_back(current);            forw_history.clear();            current = line;            cout<<current<<endl;        }else if(line == "BACK"){            if(back_history.size()==0){                cout<<"Ignored"<<endl;            }else{                line = back_history.back();                back_history.pop_back();                forw_history.push_back(current);                current = line;                cout<<current<<endl;            }        }else if(line == "FORWARD"){            if(forw_history.size()==0){                cout<<"Ignored"<<endl;            }else{                line = forw_history.back();                forw_history.pop_back();                back_history.push_back(current);                current = line;                cout<<current<<endl;            }        }        cin>>line;    }
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -