33pts求调
查看原帖
33pts求调
1022959
Ellison2012楼主2024/8/30 10:14
#include <bits/stdc++.h>
using namespace std;
#define int long long
unsigned long long n;
signed main(){
	unsigned long long t;
	cin >> t;
	while(t --){
        stack<unsigned long long> s;
		cin >> n;
		for(int i = 1 ; i <= n ; i ++){
			string op;
			cin >> op;
			if(op == "push"){
				long long x;
				cin >> x;
				s.push(x);
			}
			if(op == "query"){
				if(!s.empty()){
					cout << s.top() << endl;
				}else{
					cout << "Anguei!" << endl;
				}
			}
			if(op == "pop"){
				if(!s.empty()){
					s.pop();
				}else{
					cout << "Empty" << endl;
				}
			}
			if(op == "size"){
				cout << s.size() << endl;
			}
		}
	}
	return 0;
}
2024/8/30 10:14
加载中...