摘要:
约瑟夫环问题序列1:0,1,2...m-2,m...n-2,n-1(n-1个)序列2:m,m+1,m+2...n-1,0,1..m-2(n-1个)序列3:0,1,2...n-2,n-1(n-1个)序列4:k,k+1,k+2...k-2(n-2个)先由f[1] = 0;f[i] = (f[i-1]+k)%i递推到n-1,然后f[n] = (f[n-1] + m)%n+1即可View Code 1 #include<iostream> 2 #include<cstdio> 3 #define MAXN 10004 4 using namespace std; 5 int f 阅读全文