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 chenxuan123456789 at 2012-09-22 23:55:29 on Problem 2407
#include <stdio.h>
int main()
{
	__int64 n,i,num;
	while(scanf("%I64d",&n)&&n)
	{
		num=n;
		for(i=2;i<=n;i++)
		{
			if(n%i==0)
			{
				num=(num/i)*(i-1);
				while(n%i==0)n/=i;
			}
		}
		printf("%I64d\n",num);
	}
	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