//通过vector模拟即可,resize可以直接截取前面的数字舍弃末尾,剩下的直接简单输出就行 #include <iostream> #include <vector> #include <string> using namespace std; vector<int>res; int n; void push(int &val){ res.emplace_back(val); return; } void pop(){ if(!res.empty()){ cout<<res.back()<<endl; res...