@mayiyang
2019-08-06T12:57:28.000000Z
字数 806
阅读 589
contest
相加得:
即
for (int i=1;i<=n;i++)
sum+=n/i;
//O(sqrt(n)) 方法1
for (int i=1;i<=n;i=j+1)
{
int j=n/(n/i);
sum+=(j-i)*calc(i);//calc(i)计算n/i
}
//O(sqrt(n)) 方法2
int m=sqrt(n);
for (int i=1;i<=m;i++)
sum+=n/i;
for (int i=n/m;i>1;i--)
{
//从n/i+1到n/(i-1)
int a=n/i,b=n/(i-1);
}