求助啊啊啊啊各位佬,自己运行了一下看答案对了就来这交了,结果全是WA,大0蛋
查看原帖
求助啊啊啊啊各位佬,自己运行了一下看答案对了就来这交了,结果全是WA,大0蛋
1515241
zxyxktm楼主2024/10/20 21:45
#include<bits/stdc++.h>
using namespace std;

int main(){
	queue<int> a;
	int n;
	cin>>n;
	for(;n != 0;n--){
		int w=0,x=0;
		cin>>w;
/*1*/		if(w == 1){
			cin>>x;
			a.push(x);
		}
/*2*/		else if(w == 2){
			if(a.empty()){
		cout<<"ERR_CANNOT_POP"<<endl;		
		}
		else {
			a.pop();
		}
		}
/*3*/		else if(w == 3){
		if(a.empty()){
			cout<<"ERR_CANNOT_POP"<<endl;
		} 
		else {
			cout<<a.front()<<endl;
		}

		}
/*4*/	else if(w == 4){
			cout<<a.size()<<endl;
		}
		
	}
	return 0;
}

2024/10/20 21:45
加载中...