33pts悬关求调
查看原帖
33pts悬关求调
466596
MorningStarCzy楼主2023/11/2 20:09
#include<bits/stdc++.h>
using namespace std;
stack<unsigned long long>st;
int T,n,k;
int main()
{
	cin>>T;
	string str1;
	while(T--)
	{
		cin>>n;
		for(int i=1;i<=n;i++)
		{
			cin>>str1;
			if(str1=="push") cin>>k,st.push(k);
			if(str1=="query")
				if(st.size()!=0) cout<<st.top()<<endl;
				else cout<<"Anguei!"<<endl;
			if(str1=="size") cout<<st.size()<<endl;
			if(str1=="pop")
				if(st.size()==0) cout<<"Empty"<<endl;
				else st.pop();
		}
		while(!st.empty()) st.pop();
	}
	return 0;
}

帮了我的会给关注(你没有被我关注过)哦!

QwQQwQ

2023/11/2 20:09
加载中...