救命
查看原帖
救命
1040800
Charlie0429楼主2024/1/27 10:54
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	int a[t+5];
	string b[1000005];
	for(int i=1;i<=t;i++)
	{
		cin>>a[i];
		int s[a[i]+5],top=0;
		for(int j=1;j<=a[i];j++)
		{
			cin>>b[j];
			if(b[j]=="push")
			{
				unsigned long long x;
				cin>>x;
				top++;
				s[top]=x;
			}
			if(b[j]=="pop")
			{
				top--;
				if(top==0)
				{
					cout<<"Empty"<<endl;
				}else
				{
					cout<<top<<endl;
				}
			}
			if(b[j]=="query")
			{
				if(top==0)
				{
					cout<<"Anguei!"<<endl;
				}else
				{
					cout<<s[top]<<endl;
				}
			}
			if(b[j]=="size")
			{
				cout<<top<<endl;
			}
		}
	}
	return 0;
} 
2024/1/27 10:54
加载中...