#include<bits/stdc++.h>
using namespace std;
const int N = 100010;
int stk[N],top;
int m;
int main(){
cin >> m;
while(m--){
int x;
string st;
cin >> st;
if(st == "push"){
cin >> x;
stk[++top] = x;
}else if(st == "query"){
cout << stk[top] << endl;
}else if(st == "pop"){
--top;
}else{
if(top == 0){
cout << "Yes" << endl;
}else{
cout << "No" << endl;
}
}
}
// while(top){
// cout << stk[top] << endl;
// top--;
// }
return 0;
}
多组数据,top需要重置吧
哪道题啊