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 wangnancpp at 2010-08-28 18:31:53 on Problem 3517
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:
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