@wsndy-xx
2018-06-13T09:26:18.000000Z
字数 373
阅读 895
题解
计算 然后数论分块
或者直接数论分块
#include <iostream>
int main() {
int n, k;
long long Answer = 0;
std:: cin >> n >> k;
for(int i = 1, r; i <= n; i = r + 1) {
if(k / i) r = std:: min(n, (int)k / (k / i));
else r = n;
Answer += (1LL * (r - i + 1) * k - 1LL * (k / i) * (i + r) * (r - i + 1) / 2);
}
std:: cout << Answer;
return 0;
}