约瑟夫环
约瑟夫环
https://ac.nowcoder.com/acm/contest/19306/1003
取模忘了看:%运算
#include <iostream>
#include <vector>
using namespace std;
int n,k,m;
int main(){
cin >> n >> k >> m;
vector<int> a(n);
for(int i = 0;i < n;i++) a[i] = i;
while(a.size()>1){
k = (k + m - 1) % a.size();
a.erase(a.begin()+k);
}
cout << a[0];
}