一.队列(queue)
1.队列的基本概念
队列是只允许在一端插入,在另一端删除的线性表
队列的基本操作与栈基本相同,只是获取队头元素用的是q.front();
2.例题代码参考
例题1周末舞会
#include<bits/stdc++.h>
using namespace std;
queue<int>k;
queue<int>l;
int main(){
int a,b,c;
cin>>a>>b;
for(int i=1;i<=a;i++) k.push(i);
for(int j=1;j<=b;j++) l.push(j);
cin>>c;
for(int t=1;t<=c;t++){
cout<<k.front()<<" "<<l.front()<<endl;
k.push(k.front());k.pop();
l.push(l.front());l.pop();
}
return 0;
}