代码:
#include <iostream>
#include <stack>
#include <queue>
using namespace std;
unsigned long long n;
unsigned long long m;
stack<unsigned long long> stk;
string a;
int main(){
cin >>n;
for(int i=0;i<n;i++){
cin >>m;
for(int i=0;i<m;i++){
cin >>a;
if(a=="push"){
unsigned long long x;
cin >>x;
stk.push(x);
}
else if(a=="pop"){
if(stk.empty()==1){
cout <<"Empty"<<endl;
}
else{
stk.pop();
}
}
else if(a=="size"){
cout <<stk.size()<<endl;
}
else if(a=="query"){
if(stk.empty()==1){
cout <<"Anguei!"<<endl;
}
else{
cout <<stk.top()<<endl;
}
}
}
}
return 0;
}
看了114514遍也没看出来是什么问题,66pts