T20392.银行叫号系统 题解
2024-08-05 16:31:57
发布于:广东
#include<bits/stdc++.h>
using namespace std;
string n;
queue<string>a;
long long q;
int main(){
while(cin>>n){
if(n=="end"){
while(a.size()){
cout<<a.front()<<" ";
a.pop();
}
}
else if(n=="out"){
scanf("%d", &q);
if(!a.size())cout<<"empty"<<endl;
else{
for(int i=1;i<=q&&a.size();i++){
cout<<a.front()<<" ";
a.pop();
}
cout<<endl;
}
}else{
a.push(n);
}
}
return 0;
}
这里空空如也
有帮助,赞一个