LA3882And then there was one
Posted zcysky
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LA3882And then there was one相关的知识,希望对你有一定的参考价值。
做sb题也是一种乐趣,是吧……
#include<bits/stdc++.h> #define N 10005 using namespace std; int f[N],m,n,k; int main(){ while(scanf("%d%d%d",&n,&k,&m)&&n){ int a=0; for(int i=2;i<=n;i++)a=(a+k)%i; a=(m-k+1+a)%n;if(a<=0)a+=n; printf("%d\n",a); } }
以上是关于LA3882And then there was one的主要内容,如果未能解决你的问题,请参考以下文章
UVALive - 3882:And Then There Was One
UVALive 3882 And Then There Was One
And Then There Was One(约瑟夫问题变形)
G - And Then There Was One (约瑟夫环)