求助,第3个点WA
查看原帖
求助,第3个点WA
1247040
V_HAPPY666楼主2024/4/14 20:12
#include <bits/stdc++.h>
using namespace std;
stack <unsigned long long int> stacks;
int main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	//freopen("?.in","r",stdin);
	//freopen("?.out","w",stdout);
	int t;
	cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		while(n--)
		{
			string s;
			cin>>s;
			if(s=="push")
			{
				unsigned long long int x;
				cin>>x;
				stacks.push(x);
			}
			else if(s=="pop")
			{
				if(stacks.empty())
				{
					cout<<"Empty\n";
				}
				else
				{
					stacks.pop();
				}
			}
			else if(s=="query")
			{
				if(stacks.empty())
				{
					cout<<"Anguei!\n";
				}
				else
				{
					cout<<stacks.top()<<endl;
				}
			}
			else if(s=="size")
			{
				cout<<stacks.size()<<endl;
			}
		}
	}
	return 0;
}
2024/4/14 20:12
加载中...