鸿运当头66pts
查看原帖
鸿运当头66pts
1390324
Mr_yang1楼主2025/2/8 11:48

求调,66pts

#include<bits/stdc++.h>
using namespace std;
int t,n;
stack<unsigned long long> a;
int main(){
	cin>>t;
	while(t--){
		cin>>n;
		while(n--){
	    string s;
	    cin>>s;
	    if(s=="push"){
	    	unsigned long long ds;
	    	cin>>ds;
	    	a.push(ds); 
		}
		else if(s=="pop"){
			if(a.size()==0)cout<<"Empty\n";
			else a.pop();
		}
		else if(s=="query"){
			if(a.size()==0)cout<<"Anguei!\n";
			else cout<<a.top()<<"\n";
		}
		else{
			cout<<a.size()<<"\n";
		}
		}
	}
}
2025/2/8 11:48
加载中...