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

贴AC代码~~欧拉函数水过~~

Posted by shmr0077 at 2011-07-10 18:42:45 on Problem 2407
#include<iostream>
#include<cstdio>
using namespace std;

int main(){
	int n,i,j,num;
	while(scanf("%d",&n) && n!=0){
		num=n;
		for(i=2;i<=n;i++){
			if(n%i==0){
				num=(num/i)*(i-1);
				while(n%i==0)n/=i;
			}
		}
		printf("%d\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