int main() { ll l,r; ll n,sum=0; scanf("%lld",&n); //左端点l,右端点r; for(l=1,r=0;l<n;l=r+1) { r=n/(n/l); sum+=(r-l+1)*(n/l); } printf("%lld\n",sum); }
2023-11-19 15:15:58
int main() { ll l,r; ll n,sum=0; scanf("%lld",&n); //左端点l,右端点r; for(l=1,r=0;l<n;l=r+1) { r=n/(n/l); sum+=(r-l+1)*(n/l); } printf("%lld\n",sum); }