44 lines
768 B
C++
44 lines
768 B
C++
#include <bits/stdc++.h>
|
||
/*
|
||
测试用例I:
|
||
5 3 3
|
||
|
||
答案:
|
||
2 4 5 7 8
|
||
|
||
测试用例II:
|
||
5 4 3
|
||
|
||
5 7 8 1 2
|
||
这个测试用例可以看出由小到大排序的意义。
|
||
*/
|
||
using namespace std;
|
||
const int N = 1010;
|
||
int a[N], al;
|
||
|
||
int main() {
|
||
int x, y, k;
|
||
cin >> x >> y >> k;
|
||
queue<int> q;
|
||
int cnt = 0;
|
||
for (int i = 1; i <= x + y; i++) q.push(i);
|
||
while (q.size() > x) {
|
||
auto t = q.front();
|
||
q.pop();
|
||
cnt++;
|
||
if (cnt % k > 0)
|
||
q.push(t);
|
||
else
|
||
cnt = 0;
|
||
}
|
||
|
||
while (q.size()) {
|
||
auto t = q.front();
|
||
q.pop();
|
||
a[al++] = t;
|
||
}
|
||
sort(a, a + al);
|
||
for (int i = 0; i < al; i++) cout << a[i] << " ";
|
||
|
||
return 0;
|
||
} |