什么样的网站是php网站,做网站的平台,平面设计绘图软件,中国建筑工程师网821C - Okabe and Boxes 思路#xff1a;模拟。因为只需要比较栈顶和当前要删除的值就可以了#xff0c;所以如果栈顶和当前要删除的值不同时#xff0c;栈就可以清空了(因为下一次的栈顶不可能出现在前面那些值中)。 代码#xff1a; #includebits/stdc.h
using n…821C - Okabe and Boxes 思路模拟。因为只需要比较栈顶和当前要删除的值就可以了所以如果栈顶和当前要删除的值不同时栈就可以清空了(因为下一次的栈顶不可能出现在前面那些值中)。 代码 #includebits/stdc.h
using namespace std;
#define ll long long
vectorintst;
int main()
{ios::sync_with_stdio(false);cin.tie(0);int n,temp1,ans0;string s;cinn;for(int i0;in*2;i){cins;if(s[0]a){int a;cina;st.push_back(a);}else{if(!st.empty()st.back()!temp)st.clear(),ans;else if(!st.empty())st.pop_back();temp;}}coutansendl; return 0;
} 转载于:https://www.cnblogs.com/widsom/p/7250223.html