1332:【例2-1】周末舞会&queue适配器

#include<iostream>
#include<queue>
using namespace std;
int main(){
	int m,w,x;
	cin>>m>>w;
	queue<int> a;
	queue<int> b;
	cin>>x;
	for(int i=1;i<=m;i++){
		a.push(i);
	}
	for(int i=1;i<=w;i++){
		b.push(i);
	}
	for(int i=0;i<x;i++){
		cout<<a.front()<<" "<<b.front()<<endl;
		a.push(a.front());
		b.push(b.front());
		a.pop();
		b.pop();
	}
	return 0;
}

  

posted @ 2024-01-31 10:41  王ys  阅读(7)  评论(0编辑  收藏  举报