为什么全WA
查看原帖
为什么全WA
1040409
dhpzy楼主2023/8/18 20:51
#include<bits/stdc++.h>
using namespace std;
unsigned long long n,a,t;
string x;
int main()
{
	cin>>t;
	while(t--)
	{
		stack<unsigned long long>h;
		cin>>n;
		while(n--)
		{
			cin>>x;
			if(x=="push")
			{
				cin>>a;
				h.push(a);
			}else if(x=="pop"){
				if(h.empty()) cout<<"Empty"<<endl;
				else h.pop();
			}else if(x=="query"){
				if(h.empty()) cout<<"Anguei!"<<endl;
				else cout<<h.top();
			}else if(x=="size") cout<<h.size()<<endl;
		}
	}
}
2023/8/18 20:51
加载中...