求助,66分 最后一个点错了
查看原帖
求助,66分 最后一个点错了
1131661
MingRi_Doctor楼主2024/10/8 20:56
#include<bits/stdc++.h>
using namespace std;
stack<unsigned long long int> s;
long long t,a;
unsigned long long int b;
string x;
int main(){
	cin>>t;
	for(int i=0;i<t;i++)
	{
		scanf("%d",&a);
		for(int j=0;j<a;j++)
		{
			cin>>x;
			if(x=="push")
			{
				cin>>b;
				s.push(b);
			}
			if(x=="pop")
			{
				if(s.empty()) cout<<"Empty\n";
				else s.pop();
			}
			if(x=="query")
			{
				if(s.empty()) cout<<"Anguei!\n";
				else cout<<s.top()<<"\n";
			}
			if(x=="size") cout<<s.size()<<endl;
		}
	}
	return 0;
	
}
2024/10/8 20:56
加载中...