diff --git a/reporting-number/main.cc b/reporting-number/main.cc new file mode 100644 index 0000000..61538c2 --- /dev/null +++ b/reporting-number/main.cc @@ -0,0 +1,35 @@ +#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"); +}