Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define forn(i, x, n) for(int i = int(x); i <= int(n); ++i)
- #define for1(i, n, x) for(int i = int(n); i >= int(x); --i)
- #define file ""
- #define pb push_back
- #define F first
- #define S second
- #define _bits __builtin_popcount
- typedef long long ll;
- typedef double ld;
- typedef pair <ld, ld> PII;
- const int N = 1e4 + 1;
- const int INF = 1e9 + 9;
- const int B = 1e9 + 7;
- ld x;
- int n, f, l[N];
- vector <int> v[N], t;
- int main() {
- #ifdef machine42
- freopen(file"in", "r", stdin);
- freopen(file"out", "w", stdout);
- #endif
- ios_base :: sync_with_stdio (0);
- cin.tie(0);
- cin >> x >> n;
- int ans = 0;
- forn(i, 2, n) {
- l[i] = min(i - 1, int(x * i));
- int k = i;
- for (int j = 2; j * j <= k; ++j) {
- if (k % j == 0) v[i].pb(j);
- while (k % j == 0) k /= j;
- }
- if (k > 1) v[i].pb(k);
- if (l[i] >= 1) ++ans;
- }
- forn(i, 2, n) {
- forn(j, 2, l[i]) {
- f = 0;
- for (auto x : v[i]) {
- if (j % x == 0) {
- f = 1;
- break;
- }
- }
- if (!f) ++ans;
- }
- }
- cout << ans << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement