暴力+模拟
#include<iostream>
#include<cstring>
using namespace std; int ans, k, k2;
bool a[]; bool f(int m){
int u = ;
memset(a, false, sizeof(a));
for (int j = ; j < k; ++j){ //杀掉k个人
int n = m % (k2 - j);
if (k2 - j <= m)n += k2 - j; //将圈子缩小
for (int j = ; j <= n; ++j){ //模拟走到要杀的人那里
u++;
while (a[u] == true)++u;
if (u>k2)u = ;
}
a[u] = true;
if (u <= k)
return false;
}
return ans = m;
} int main(){
cin >> k; k2 = k * ;
for (int i = k + ; !f(i); ++i); cout << ans << endl;
return ;
}