1968. [AHOI2005]约数研究【数论】

Description

Input

只有一行一个整数 N(0 < N < 1000000)。

Output

只有一行输出,为整数M,即f(1)到f(N)的累加和。

Sample Input

3

Sample Output

5

http://blog.csdn.net/aarongzk/article/details/50647495

 1 #include<iostream>
 2 #include<cstdio>
 3 using namespace std;
 4 int n,ans;
 5 int main() 
 6 {
 7     scanf("%d",&n);
 8     for(int i=1; i<=n; i++) 
 9         ans+=n/i;
10     printf("%d
",ans);
11 }
原文地址:https://www.cnblogs.com/refun/p/8682441.html