This commit is contained in:
e2hang
2025-08-14 19:48:01 +08:00
parent 5ebd540fa5
commit f40ad1c843
6 changed files with 114 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#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;
}