Yang_Jun @ 2024-12-05 19:17:20
#include<bits/stdc++.h>
using namespace std;
stack<long long>t;
string a[10000000];
long long An[10000000];
int main(){
long long n[1000],m;
cin>>m;
long long j=0;
for(long long k=0;k<m;k++){
cin>>n[k];
for(long long i=0;i<n[k];i++){
cin>>a[i];
if(a[i]=="push"){
long long b;
cin>>b;
t.push(b);
}
else if(a[i]=="pop"){
if(t.empty()) {
An[j]=-1;j++;}
else t.pop();
}
else if(a[i]=="query"){
if(t.empty())
An[j]=-2;
else An[j]=t.top();
j++;
}else if(a[i]=="size"){
An[j]=t.size();
j++;
}
}}
for(long long i=0;i<j;i++){
if(An[i]==-2) cout<<"Anguei!"<<endl;
else if(An[i]==-1) cout<<"Empty"<<endl;
else cout<<An[i]<<endl;
}
return 0;
}
by yise @ 2024-12-05 19:33:14
@yangjun37 输入都错了,谁帮你看?
by Ahws_rwhy @ 2024-12-05 19:33:36
@yangjun37开 ull