1AC 2WA 求助
查看原帖
1AC 2WA 求助
1111873
qiufangguo楼主2024/7/19 16:35
#include<bits/stdc++.h>
using namespace std;
unsigned long long int st[1000001];
int sum=0,t,n,top=0,a;
string s;
int main(){
	cin>>t;
	for(int i=0;i<t;i++){
		cin>>n;
		for(int j=0;j<n;j++){
			cin>>s;
			if(s=="push"){
				cin>>a;
				st[++top]=a;
			}
			else if(s=="pop"){
				if(top==0)cout<<"Empty"<<endl;
				else top--;
			}
			else if(s=="query"){
				if(top==0)cout<<"Anguei!"<<endl;
				else cout<<st[top]<<endl;
			}
			else if(s=="size"){
				cout<<top<<endl;
			}	
		}
		memset(st,0,sizeof(st));
	}
	return 0;
}
2024/7/19 16:35
加载中...