23 lines
386 B
C++
23 lines
386 B
C++
#include <iostream>
|
|
#include <vector>
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int n, m;
|
|
cin >> n >> m;
|
|
vector<int> a;
|
|
for (int i = 0; i < n; i++) {
|
|
a.push_back(i + 1);
|
|
}
|
|
|
|
int idx = 0;
|
|
while (!a.empty()) {
|
|
idx = (idx + m - 1) % a.size();
|
|
cout << a[idx] << " ";
|
|
a.erase(a.begin() + idx);
|
|
}
|
|
cout << endl;
|
|
return 0;
|
|
}
|
|
|