解题思路:
注意事项:
参考代码:
#include <bits/stdc++.h> using namespace std; queue<int> q; int main() { int n; cin >> n; int op, num; while(n --) { cin >> op; if(op == 1) { cin >> num; q.push(num); } else if(op == 2) { if(!q.empty()) { cout << q.front() << endl; q.pop(); } else return cout << "no", 0; //输出no并退出程序 } else if(op == 3) { cout << q.size() << endl; } } return 0; }
0.0分
0 人评分