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 |
我是用 Euler PHI 函数做的,程序相当简单,但是错了,急求高手!#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