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<stdio.h> int m,n,k; int ans(int num) { if(num==1) return 0; return (k+ans(num-1))%num; } int main() { scanf("%d %d %d",&n,&k,&m); while(n) { printf("%d\n",(ans(n-1)+m)%n+1); scanf("%d %d %d",&n,&k,&m); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator