34 lines
717 B
C++
34 lines
717 B
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int o, p, q, n;
|
|
cin >> o >> p >> q >> n;
|
|
queue<int> oq, pq, qq;
|
|
//填充三个队列
|
|
for (int i = 0; i < o; ++i) {
|
|
oq.push(i + 1);
|
|
}
|
|
for (int i = 0; i < p; ++i) {
|
|
pq.push(i + 1);
|
|
}
|
|
for (int i = 0; i < q; ++i) {
|
|
qq.push(i + 1);
|
|
}
|
|
//开始模拟轮次
|
|
for (int i = 0; i < n; ++i) {
|
|
int a = oq.front();
|
|
int b = pq.front();
|
|
int c = qq.front();
|
|
cout << a << " " << b << " " << c << endl;
|
|
oq.pop();
|
|
pq.pop();
|
|
qq.pop();
|
|
oq.push(a);
|
|
pq.push(b);
|
|
qq.push(c);
|
|
}
|
|
return 0;
|
|
}
|