求调
查看原帖
求调
820097
he_lucky楼主2025/1/13 19:27
#include <bits/stdc++.h>
using namespace std;
queue<int> q;
int n;
int main(){
	scanf("%d",&n);
	while (n--){
		int x,y;
		scanf("%d",&x);
		if (x == 1){
			scanf("%d",&y);
			q.push(y);
		}else if (x == 2){
			if (q.empty()){printf("ERR_CANNOT_POP\n");
			}else{
				q.pop();
			}
		}else if (x == 3){
			if (q.empty()){printf("ERR_CANNOT_QUERY\n");
			}else{
				printf("%d\n",q.front());
			}
		}else{
			printf("%d",q.size());
		}
	}
	return 0;
}
2025/1/13 19:27
加载中...