33pts求解
查看原帖
33pts求解
390150
平等与晚钟楼主2024/7/10 10:59
#include<bits/stdc++.h>
using namespace std;
long long q[100000];
long long t=0;
void _1()
{
	long long x;
	scanf("%lld",&x);
	q[++t]=x;
}
void _2()
{
	if(t)t--;
	else printf("Empty\n");
}
void _3()
{
	if(t)printf("%d\n",q[t]);
	else printf("Anguei!\n");
}
int main()
{
	int q;
	scanf("%d",&q);
	while(q--)
	{
		int n;
		scanf("%d",&n);
		while(n--)
		{
			string a;
			cin>>a;
			if(a=="push")_1();
			if(a=="pop")_2();
			if(a=="query")_3();
			if(a=="size")cout<<t<<endl;
		}
	}
}
2024/7/10 10:59
加载中...