样例3WA,求助!!!
查看原帖
样例3WA,求助!!!
1073630
morning_hope楼主2024/6/21 21:16
#include<bits/stdc++.h>
using namespace std;
int m;
int main(){
	stack<unsigned long long> ss;
	unsigned long long n,x;
	string s;
	scanf("%llu",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&m);
		for(int j=1;j<=m;j++){
			cin>>s;
			if(s=="push"){
				scanf("%llu",&x);
				ss.push(x);
			}
			if(s=="query"){
				if(ss.size()!=0)
				printf("%llu\n",ss.top());
				else printf("Anguei!\n");
			}
			if(s=="pop"){
				if(ss.size()!=0)
					ss.pop();
				else printf("Empty\n");
			}
			if(s=="size") printf("%llu\n",ss.size());
		}
	}
	return 0;
} 
2024/6/21 21:16
加载中...