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 F117 at 2007-03-26 19:34:13 on Problem 2480
#include<stdio.h>
#include<math.h>
int eula(int N)
{
	if(N==2)return 1;
	if(N==3)return 2;
	int sq=sqrt(N),E=N;
	for(int j=2;j<=sq;++j)
	{
		if(N%j==0)
		{
			E=E*(j-1)/j;
			while(N%j==0)N=N/j;
		}
	}
	if(N!=1)E=E*(N-1)/N;
	return E;
}

int main()
{
	int N;
    __int64 sum=0;
	while(scanf("%d",&N)+1)
	{
		if(N==1)sum=1;if(N==2)sum=3;if(N==3)sum=5;
		if(sum){printf("%I64d\n",sum);sum=0;continue;}
		sum=N;
		int sq=sqrt(N);
		for(int i=2;i<=sq;++i)
		{
            if(N%i==0)
			{
				int r=N/i;
			    sum=sum+eula(i)*r;
			    if(i!=r)sum=sum+eula(r)*i;
			}
		}
		sum=sum+eula(N);
		printf("%I64d\n",sum);
		sum=0;
	}
    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