#include <bits/stdc++.h>
#define ld long double
#define ll long long
#define sz size()
#define all(xx) xx.begin(),xx.end()
#define pb push_back
#define in insert
#define er erase
#define S second
#define F first
#define pii pair <int, int>
#define to_be continue
#define mp make_pair
#define stop exit (0)
#define fname ""
#define speed ios_base::sync_with_stdio(0);cin.tie(0)
#define input freopen (fname".in", "r", stdin)
#define output freopen (fname".out", "w", stdout)
#define int ll
#define N 10200000
using namespace std;
const int inf = 1e9 + 123;
const ll INF = 1e18 + 123;
const double pi = acos (-1.0);
const ld eps = 1e-3;
ll a, b, ans, cur;
main ()
{
speed;
cin >> a >> b;
for (ll i = 1; i <= N; i ++)
{
if ((b / i) - 1 <= 0)
break;
if (!max (((a - 1ll) / i), 0ll))
ans += i * (max (((b / i) - max (((a - 1ll) / i), 0ll) - 1), 0ll));
else
ans += i * (max (((b / i) - max (((a - 1ll) / i), 0ll)), 0ll));
}
for (ll j = a; j <= b; j ++)
cur += j;
cout << abs (cur - ans);
}
//Coded by A....
Compilation message
savrsen.cpp:32:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main ()
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
3 |
Incorrect |
3 ms |
504 KB |
Output isn't correct |
4 |
Incorrect |
137 ms |
504 KB |
Output isn't correct |
5 |
Incorrect |
141 ms |
504 KB |
Output isn't correct |
6 |
Incorrect |
146 ms |
520 KB |
Output isn't correct |
7 |
Incorrect |
139 ms |
688 KB |
Output isn't correct |
8 |
Incorrect |
38 ms |
688 KB |
Output isn't correct |