
标签:discus 线性 arc signed print class desc geo 欧拉函数
智障的我看到N的范围就像线性求欧拉函数,没救了……
只需要枚举1到N中的每个数,计算其是几个范围内的数的约数即可。
1 #include<bits/stdc++.h> 2 3 signed main(void) 4 { 5 int n; scanf("%d", &n); 6 long long ans = 0; 7 for (int i = 1; i <= n; ++i) 8 ans += n / i; 9 printf("%lld\n", ans); 10 }
@Author: YouSiki
BZOJ 1968: [Ahoi2005]COMMON 约数研究
标签:discus 线性 arc signed print class desc geo 欧拉函数
原文地址:http://www.cnblogs.com/yousiki/p/6216114.html