为啥我这只有33分
查看原帖
为啥我这只有33分
1062697
hellocccl楼主2023/12/15 13:51
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
	int t;cin>>t;
	while(t--){
		int n;cin>>n;
		stack<ll>cl;
		for(int i=1;i<=n;i++){
			string x;cin>>x;
			if(x=="push"){
				ll y;cin>>y;
				cl.push(y);
			}
			if(x=="query"){
				if(cl.empty()){
					cout<<"Anguei!"<<'\n';
				}
				else{
					cout<<cl.top()<<'\n';
				}
			}
			if(x=="pop"){
				if(cl.empty()){
					cout<<"Empty"<<'\n';
				}
				else{
					cl.pop();
				}
			}
			if(x=="size"){
				cout<<cl.size()<<'\n';
			}
		}
	}
}
2023/12/15 13:51
加载中...