-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGold_1_grade.cpp
More file actions
52 lines (36 loc) · 792 Bytes
/
Copy pathGold_1_grade.cpp
File metadata and controls
52 lines (36 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>
#include <unordered_map>
#include <regex>
#include <map>
using namespace std;
typedef long long ll;
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
ll a, b;
cin >> a >> b;
ll k = 2;
ll sum = b - a + 1;
vector<bool> res(b - a + 1, false);
while (k * k <= b)
{
ll temp = a / (k * k);
if (a % (k * k) != 0)
temp += 1;
while (temp * (k * k) <= b)
{
if (res[temp * (k * k) - a] == false)
{
res[temp * (k * k) - a] = true;
sum--;
}
temp++;
}
k++;
}
cout << sum << endl;
return 0;
}