#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair <int, int>
#define sz(a) (int)(a.size())
#define resize(v) v.resize(unique(all(v)) - v.begin());
#define all(a) a.begin(), a.end()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)
using namespace std;
void Fast_Read_Out()
{
ios_base::sync_with_stdio(0);
cin.tie(), cout.tie();
}
void Random()
{
unsigned int seed;
asm("rdtsc" : "=A" (seed));
srand(seed);
}
unsigned int Time()
{
unsigned int time = clock() / 1000.00;
return time;
}
const int inf = (1e9) + 123;
const int N = (1e7) + 1;
long long sum[N];
void Resheto()
{
for(int i = 1; i <= N; i++)
if(i + i <= N)
for(int j = i + i; j <= N; j += i) sum[j] = i;
}
main ()
{
#ifdef JUDGE
freopen("input.txt", "r", stdin);
#endif
Random();
Fast_Read_Out();
long long a, b;
cin >> a >> b;
long long sm = 0;
Resheto();
for(int i = a; i <= b; i++) sm += abs(i - sum[i] - 1);
cout << sm + 1 << endl;
#ifdef JUDGE
// cout << Time() << endl;
#endif
}
// Easy Peasy Lemon Squeezy Sometimes it's the very people who no one imagines anything of who do the things no one can imagine.
Compilation message
savrsen.cpp:45:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main ()
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2487 ms |
78648 KB |
Output isn't correct |
2 |
Incorrect |
2539 ms |
78748 KB |
Output isn't correct |
3 |
Incorrect |
2562 ms |
78748 KB |
Output isn't correct |
4 |
Incorrect |
2516 ms |
78804 KB |
Output isn't correct |
5 |
Incorrect |
2538 ms |
78812 KB |
Output isn't correct |
6 |
Incorrect |
2551 ms |
78812 KB |
Output isn't correct |
7 |
Incorrect |
2498 ms |
78872 KB |
Output isn't correct |
8 |
Incorrect |
2507 ms |
78872 KB |
Output isn't correct |