Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

顶一个,看我的代码!

Posted by mingruoyuan at 2009-07-03 15:37:14 on Problem 3517
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator