top1编程
← 返回题目
题解

【入门】叫号软件

1 条题解

  • 0
    @ 2026-7-28 23:24:20
    #include<bits/stdc++.h>
    using namespace std;
    queue<string>a;
    int main(){
    	string s,c;
    	while(cin>>s){
    		if(s=="END"){
    			break;
    		}else if(s=="PUSH"){
    			cin>>c;
    			a.push(c);
    		}else if(s=="POP"){
    			if(a.empty()==1){
    				cout<<"EMPTY"<<endl;
    			}else{
    				cout<<a.front()<<endl;
    				a.pop();
    			}
    		}
    	}
    	return 0;
    }
    
    • 1