栈为什么开了unsigned long long还错
  • 板块灌水区
  • 楼主potatoplanet720
  • 当前回复9
  • 已保存回复9
  • 发布时间2023/9/9 21:45
  • 上次更新2023/11/2 21:46:16
查看原帖
栈为什么开了unsigned long long还错
935758
potatoplanet720楼主2023/9/9 21:45
#include<iostream>
using namespace std;
unsigned long long a[100005];
int main(){
	unsigned long long n,m,top=0,x;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>m;
		for(int j=1;j<=m;j++){
			string s;
			cin>>s;
			if(s=="push"){
				cin>>x;
				a[++top]=x;
			}else if(s=="pop"){
				if(top==0) cout<<"Empty"<<endl;
				else top--;
			}else if(s=="query"){
				if(top==0) cout<<"Anguei!"<<endl;
				else cout<<a[top]<<endl;
			}else if(s=="size") cout<<top<<endl;
			
		}
	}
	return 0;
} 
2023/9/9 21:45
加载中...