0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

[80pts] 1257. [CQOI2007] 余数之和 sum

https://hydro.ac/d/bzoj/record/61e286cf3c2110ae40549b01
This commit is contained in:
Baoshuo Ren 2022-01-16 08:46:31 +08:00 committed by Baoshuo Ren
parent 3f3a5b9423
commit 840a925ada
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

18
Hydro/bzoj/1257/1257.cpp Normal file
View File

@ -0,0 +1,18 @@
#include <cmath>
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
long long n, k, ans;
int main() {
cin >> n >> k;
ans = n * k;
for (int x = 1; x <= n; x++) {
ans -= floor(1.0 * k / x) * x;
}
cout << ans << endl;
return 0;
}