WA#3
查看原帖
WA#3
1083280
ctjy1216楼主2024/6/16 10:52
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
int main()
{
	stack<ull> s;
	ull x;
	int t,n;
	string a;
	cin >> t;
	while(t--)
	{
		cin >> n;
		while(n--){
			cin >> a;
			if(a=="push"){
				cin >> x;
				s.push(x);
			}
			if(a=="pop"){
				if(s.empty())cout<<"Empty"<<endl;
				else s.pop();
			}
			if(a=="query"){
				if(s.empty())cout<<"Anguei!"<<endl;
				else cout<<s.top()<<endl;
			}
			if(a=="size"){
				cout << s.size() << endl;
			}
		}
	}
	return 0;
}
2024/6/16 10:52
加载中...