RE求调
查看原帖
RE求调
412639
dddlam楼主2023/12/6 13:22

1AC 2RE

#include <bits/stdc++.h>
using namespace std;
stack <int> a;
int n;
void cla()
{
	assert(a.empty());
	return ;
}
int main() {
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int m;
		cin>>m;
		for(int j=1;j<=m;j++)
		{
			string s;
			cin>>s;
			if(s=="push")
			{
				long long x;
				cin>>x;
				a.push(x);
			}else if(s=="query")
			{
				if(!a.empty())
				cout<<a.top()<<endl;
				else
				cout<<"Anguei!"<<endl;
			}else if(s=="pop")
			{
				if(!a.empty())
				a.pop();
				else
				cout<<"Empty"<<endl;
			}else{
				cout<<a.size()<<endl;
			}
		}
		cla();
	}
	return 0;
}
2023/12/6 13:22
加载中...