mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-14 04:38:46 +00:00
30 lines
452 B
C++
30 lines
452 B
C++
#include <iostream>
|
|
|
|
using std::cin;
|
|
using std::cout;
|
|
const char endl = '\n';
|
|
|
|
long long n, k, ans;
|
|
|
|
int main() {
|
|
std::ios::sync_with_stdio(false);
|
|
|
|
cin >> n >> k;
|
|
|
|
ans = n * k;
|
|
|
|
for (long long l = 1, r; l <= n; l = r + 1) {
|
|
if (k / l) {
|
|
r = std::min(k / (k / l), n);
|
|
} else {
|
|
r = n;
|
|
}
|
|
|
|
ans -= (r + l) * (k / l) * (r - l + 1) / 2;
|
|
}
|
|
|
|
cout << ans << endl;
|
|
|
|
return 0;
|
|
}
|