1968: [Ahoi2005]COMMON 约数研究

Time Limit: 1 Sec  Memory Limit: 64 MB

Description

bzoj 1968: [Ahoi2005]COMMON 约数研究

Input

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

Output

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

Sample Input

3

Sample Output

5

HINT

 

Source

 

#include<cstdio>
long long n,s;
int main()
{
    scanf("%lld",&n);
    for(int i=1,j=0;i<=n;i=j+1)
    {
        j=n/(n/i);
        s+=(j-i+1)*(n/i);
    }
    printf("%lld\n",s);
}

 

 

 

相关文章:

  • 2022-02-26
  • 2021-07-27
  • 2021-08-17
  • 2022-01-14
  • 2021-06-15
  • 2021-07-18
  • 2022-12-23
猜你喜欢
  • 2021-06-02
  • 2022-01-11
  • 2022-01-31
  • 2022-12-23
  • 2021-05-20
相关资源
相似解决方案