| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
终于错了一个In Reply To:大哥们,看看我的程序吧,我有很好的思想,但我确实不知道错在哪里了 Posted by:gardner at 2005-10-15 03:47:46 > #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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator