#include #include #include #include using namespace std; int main() { queue q; int X, Y, K; cin >> X >> Y >> K; for (int i = 1; i <= X + Y; i++) { q.push(i); } int count = 0; while (q.size() > X) { count++; if (count == K) { q.pop(); count = 0; } else { auto pin = q.front(); q.pop(); q.push(pin); } }; vector v; while (q.size() > 0) { v.push_back(q.front()); q.pop(); } sort(v.begin(), v.end()); for (int i = 0; i < v.size(); i++) { printf("%d ", v[i]); } printf("\n"); }