Accepted
代码
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
long long n;
int main()
{
scanf("%lld",&n);
long long ans=0,tmp=0;
for(long long a=1,v;a*a<=(v=n/a);a++,ans++)
for(long long b=a+1;b*b<=v;b++)
tmp+=n/(a*b)-b;
ans+=tmp*6;
tmp=0;
for(long long a=1,v;(v=a*a)<=n;a++)//减去数重复的情况
{
tmp+=n/v;
if(a*a<=n/a)tmp--;
}
ans+=tmp*3;
printf("%lld\n",ans);
return 0;
}