约瑟夫环wuwuwu
#include<bits/stdc++.h> using namespace std; int f(int n, int k) { if(n == 1) return 0; return (f(n - 1, k) + k) % n; } int main() { int n; cin >> n; cout << f(n, 3) + 1 << endl; return 0; }