66,不知为什么。。。求助!!!
查看原帖
66,不知为什么。。。求助!!!
898525
jianghl666_IKUN楼主2024/7/3 14:11
#include<bits/stdc++.h>
using namespace std;
const long long N=1e6+10;
unsigned long long x[N],t,n,hz,h;
string cz; 
int main(){
	cin>>t;
	for(int i=0;i<t;i++){
		cin>>n;
		for(int j=0;j<n;j++){
			cin>>cz;
			if(cz=="push"){
				cin>>h;
				x[hz+1]=h;
				hz++;
			}
			else if(cz=="pop"){
				if(hz!=0)hz--;
				else cout<<"Empty"<<endl;
			}
			else if(cz=="query"){
				if(hz!=0)cout<<x[hz]<<endl;
				else cout<<"Anguei!"<<endl;
			}
			else cout<<hz<<endl;	
		}
	}
    return 0;
}

代码

2024/7/3 14:11
加载中...