wegtfds
查看原帖
wegtfds
736027
zhouchenrui楼主2024/11/30 19:15
#include<bits/stdc++.h>
using namespace std;
queue<int> q;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		if(x==1){
			int y;
			cin>>y;
			q.push(y);
		}else if(x==2){
			if(!q.empty()){
				q.pop();
			}else{
				cout<<"ERR_CANNOT_POP"<<endl;	
			}
		}else if(x==3){
			if(!q.empty()){
				cout<<q.front()<<endl;
			}else{
				cout<<"ERR_CANNOT_QUERY"<<endl;	
			}
		}else{
			cout<<q.size()<<endl;
		}
	} 
	return 0;
}

2024/11/30 19:15
加载中...