Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
多谢提示!轻松水过……………………In Reply To:转载 算法 Posted by:LUCKLY at 2008-03-13 12:54:41 #include <iostream> using namespace std; int main() { //freopen("input.txt","r",stdin); int n,k,m,x; while(scanf("%d %d %d",&n,&k,&m)&&n) { x=0; for(int i=2;i<=n;++i) x=(x+k%i)%i; x+=(m-k); x%=n; if(x<0) x+=n; printf("%d\n",x+1); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator