标签:style blog io color os for sp div log
用了质因数分解的方法:
//欧拉函数 #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<algorithm> #include<cmath> #include<queue> using namespace std; int ef(int n) { int cnt = n; for(int i=2;i<=n;i++) { if(n%i==0) { cnt-=cnt / i; n/=i; while(n%i==0) { n/=i; } } } return cnt; } int main() {int n; scanf("%d",&n); cout<<ef(n)<<endl; return 0; }
标签:style blog io color os for sp div log
原文地址:http://www.cnblogs.com/coutendl/p/4077251.html