| ||||||||||
| 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 | |||||||||
其实就是欧拉函数!附代码!#include <stdio.h>
int main()
{
__int64 n,i,num;
while(scanf("%I64d",&n)&&n)
{
num=n;
for(i=2;i<=n;i++)
{
if(n%i==0)
{
num=(num/i)*(i-1);
while(n%i==0)n/=i;
}
}
printf("%I64d\n",num);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator