| ||||||||||
| 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 | |||||||||
贴AC代码~~欧拉函数水过~~#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator