队列练习(1)
#include<cstdio> #include<iostream> #include<queue> using namespace std; int n,k,a; int main() { queue<int>line; cin>>n; while(n--) { cin>>k; if(k==1) { cin>>a; line.push(a); } if(k==2) { line.pop(); } } if(line.empty()) cout<<"impossible!"<<endl; else cout<<line.front()<<endl; return 0; }