33分求助
查看原帖
33分求助
677489
Aaron530楼主2024/10/24 09:18

为什么开了unsigned long long还是33分

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
list <ULL> stk;
int T,n;
string s;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>T;
	while(T--)
	{
		cin>>n;
		for(int i=1;i<=n;i++)
		{
			cin>>s;
			if(s=="push")
			{
				int x;
				cin>>x;
				stk.push_back(x);
			}
			if(s=="pop")
			{
				if(stk.empty())
					cout<<"Empty"<<endl;
				else
					stk.pop_back();
			}
			if(s=="query")
			{
				if(stk.empty())
					cout<<"Anguei!"<<endl;
				else
					cout<<stk.back()<<endl;
			}
			if(s=="size")
				cout<<stk.size()<<endl;
		}
	}
	return 0;
}

2024/10/24 09:18
加载中...