蒟蒻全WA求助
查看原帖
蒟蒻全WA求助
816030
zhiyinhaoshan楼主2022/10/13 18:14

自己在电脑上试了,样例都过不了,但是自己也没看出来错误,求大佬指教!

#include<bits/stdc++.h>
using namespace std;
queue<int> k;
int main(){
	int x;
	short c,n;
	cin>>n;
	while (n--){
		cin>>c;
		if (c=='1'){
			cin>>x;
			k.push(x);
		}
		if (c=='2'){
			if (k.size()==0)
				cout<<"ERR_CANNOT_POP\n";
			else
				k.pop();
		}
		if (c=='3'){
			if (k.size()==0)
				cout<<"ERR_CANNOT_QUERY\n";
			else
				cout<<k.front()<<'\n';
		}
		if (c='4')
			cout<<k.size()<<'\n';
	}
	return 0;
}
2022/10/13 18:14
加载中...