You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
717 B
34 lines
717 B
#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;
|
|
}
|