标签:des style color java os io strong for
3 4 0
0 2
#include <iostream> #include <cstdio> using namespace std; #define LL __int64 LL eular(LL n) // 求欧拉函数 { LL i,res=n; for(i=2;i*i<=n;i++) { if(n%i==0) { res=res/i*(i-1); while(n%i==0) n/=i; } } if(n>1) res=res/n*(n-1); return res; } int main() { LL n; while(scanf("%I64d",&n)&&n!=0) { if(n==1) { printf("0\n"); continue; } LL k=eular(n); //printf("%I64d\n",k); // n的欧拉函数值 //printf("%I64d\n",n*k/2); // 小于n 且与n互质的数 之和 printf("%I64d\n",((n-1)*n/2-n*k/2)%1000000007); //小于n 且与n不互质的数 之和 } return 0; }
hdu 3501 Calculation 2,布布扣,bubuko.com
标签:des style color java os io strong for
原文地址:http://blog.csdn.net/fyxz1314/article/details/38532109