0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 15:48:48 +00:00

B3969 [GESP202403 五级] B-smooth 数

https://www.luogu.com.cn/record/174743452
This commit is contained in:
Baoshuo Ren 2024-08-25 23:50:16 +08:00
parent c7114f4976
commit 7cd1049391
Failed to extract signature

34
Luogu/B3969/B3969.cpp Normal file
View File

@ -0,0 +1,34 @@
#include <iostream>
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;
}