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 gardner at 2005-10-15 03:47:46 on Problem 2407
#include <stdio.h>
void main()
{
	long input,i,save;
	scanf("%ld",&input);
	while(input!=0){
		if(input==1)printf("0\n");
		else {
			save=input;
			if(input%2==0)save/=2;
			while(input%2==0)input/=2;
			for(i=3;input!=1;i=i+2){
				if(input%i==0)save=save*(i-1)/i;
				while(input%i==0)input/=i;
			}
			printf("%ld\n",save);
		}
		scanf("%ld",&input);
	}
}

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