WA求助
查看原帖
WA求助
725788
zyabc楼主2022/9/6 13:18

已经用了unsigned long long,为啥还是 WA

#include<bits/stdc++.h>
using namespace std;
const int MAXN=10005;
int T,N; 
unsigned long long x;
string op;
stack<unsigned long long> sta;

int main()
{
	cin>>T;
	for(int i=1;i<=T;i++)
	{
		scanf("%d",&N);
		for(int j=1;j<=N;j++)
		{
			scanf("%s",op.c_str());
			
			if(strcmp(op.c_str(),"push")==0) {scanf("%llu",&x);sta.push(x);
			}
			else if(strcmp(op.c_str(),"pop")==0) {
				if(sta.empty()) cout<<"Empty"<<endl;
				else sta.pop();
			}
			else if(strcmp(op.c_str(),"query")==0)
			{
				if(sta.empty()) cout<<"Anguei!"<<endl;
				else printf("%llu",sta.top());
			}
			else if(strcmp(op.c_str(),"size")==0)
			{
				 cout<<sta.size()<<endl;
			}
		
			
		}
	}
	

	return 0; 
	
} 
2022/9/6 13:18
加载中...