diff --git a/Luogu/B3969/B3969.cpp b/Luogu/B3969/B3969.cpp new file mode 100644 index 00000000..30f594c8 --- /dev/null +++ b/Luogu/B3969/B3969.cpp @@ -0,0 +1,34 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1e6 + 5; + +int n, b, a[N]{0, 1}, cnt; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n >> b; + + for (int i = 2; i <= n; i++) { + if (a[i] == 0) { + for (int j = i; j <= n; j += i) { + a[j] = i; + } + } + } + + for (int i = 1; i <= n; i++) { + if (a[i] <= b) { + cnt++; + } + } + + cout << cnt << endl; + + return 0; +}