B3614 【模板】栈
#include<bits/stdc++.h>
using namespace std;
string s;
int t,n;
int top;
unsigned long long a[1000005],x;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>t;
top=1;
for(int i=1;i<=t;i++)
{
cin>>n;
for(int j=1;j<=n;j++)
{
cin>>s;
if(s=="push")
{
cin>>x;
a[top]=x;
top++;
}
else if(s=="query")
{
if(top==1)cout<<"Anguei!"<<endl;
else cout<<a[top-1]<<endl;
}
else if(s=="size")
{
cout<<top-1<<endl;
}
else if(s=="pop")
{
if(top==1)cout<<"Empty"<<endl;
else
{
a[top-1]=0;
top--;
}
}
}
}
return 0;
}