【代码】
#include<bits/stdc++.h>
#define LL long long
using namespace std;
int main() {
LL n, k, t, ans;
#define LL long long
scanf("%lld%lld", &n, &k);
ans = (LL) n * k;
for(LL l = 1,r; l <= n;l = r + 1) {
r = (t = k / l) ? min(k / t, n) : n;
ans = (ans - (r - l + 1) * t * (l + r) / 2);
}
printf("%lld\n", ans);
return 0;
}
原文地址:https://www.cnblogs.com/kcfzyhq/p/8665622.html
时间: 2024-10-07 20:12:23