代码如下:
#include<bits/stdc++.h>
using namespace std;
long long a[1145140];
int head=0;
int main()
{
int n,s;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>s;
for(int j=1;j<=s;j++)
{
string m;
cin>>m;
if(m=="push")
{
unsigned long long x;
cin>>x;
a[++head]=x;
}
if(m=="pop")
{
if(head==0) cout<<"Empty\n";
else head--;
}
if(m=="query")
{
if(head==0) cout<<"Anguei!\n";
else cout<<a[head]<<endl;
}
if(m=="size") cout<<head<<endl;
}
head=0;
}
return 0;
}