#26307: 腦殘作法


joey13130905@gmail.com (笨呆瓜)

學校 : 淡江大學
編號 : 89206
來源 : [1.163.240.33]
最後登入時間 :
2023-11-06 14:53:44

#include <iostream> 

#include <queue> 

using namespace std;

 

int main(){

ios_base::sync_with_stdio(0);

cin.tie(0);

int n,k,s;

queue<int>q;

while(cin>>n){

while(n--){

cin>>k;

if(k==1){

cin>>s;

q.push(s);

}

if(k==2){

if(!q.empty())

cout<<q.front()<<"\n";

else

cout<<-1<<"\n";

}  

if(k==3){

if(q.empty())

continue;

q.pop();

}

}

return 0;