标签:scanf pac ret div col mes turn 约数 clu
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 5 using namespace std; 6 typedef long long LL; 7 8 LL Eular(LL m) 9 { 10 LL res = m; 11 for(LL i=2; i*i<=m; i++) 12 { 13 if(m%i==0) 14 { 15 res -= res/i; 16 while(m%i==0) 17 m /= i; 18 } 19 } 20 if(m > 1) 21 res -= res/m; 22 return res; 23 } 24 25 int main() 26 { 27 LL m; 28 while(~scanf("%lld",&m)) 29 { 30 LL ans = 0; 31 for(LL i=1; i*i<=m; i++) 32 { 33 if(m%i == 0){ 34 ans += Eular(m/i)*i; 35 if(m != i*i) 36 ans += m/i*Eular(i); 37 } 38 } 39 cout<<ans<<endl; 40 } 41 return 0; 42 }
标签:scanf pac ret div col mes turn 约数 clu
原文地址:https://www.cnblogs.com/jaydenouyang/p/9016253.html