各位大佬,一个RE
查看原帖
各位大佬,一个RE
995531
forest4188楼主2024/3/25 15:09
#include<cstdio>
#include<string>
#include<iostream>
using namespace std;
unsigned long long x;
const int N = 1e3 + 10;
string a;
int TOP = 0;
unsigned long long st[N];
bool empty()
{
	return TOP == 0;
}
void push(unsigned long long x)
{
	st[++TOP] = x;
}
void pop()
{
	if(!empty())
	{
		TOP --;
	}
}
unsigned long long query()
{
	return st[TOP];
}
int size()
{
	return TOP;
}
void pd(string a)
{
	if(a == "push")
	{
		scanf("%llu",&x);
		push(x);
	}
	if(a == "pop")
	{
		if(empty()) printf("Empty\n");
		else pop();
	} 
	if(a == "query")
	{
		if(empty()) printf("Anguei!\n");
		else printf("%llu\n",query());
	}
	if(a == "size") printf("%d\n",size());
}
int main()
{
	int t,n;
	scanf("%d",&t);
	for(int i = 1;i <= t;++ i)
	{
		scanf("%d",&n);
		for(int j = 1;j <= n;++ j)
		{
			cin >> a;
			pd(a);
		}
	} 
	return 0;
}```
哪里哪里有毛病
2024/3/25 15:09
加载中...