#include <bits/stdc++.h>
using namespace std;
const int N = 1e8 + 5;
bool vis[N];
vector<int> prim;
void get_prime(int n){
for (int i = 2; i <= n; i++){
if (!vis[i]) {
prim.push_back(i);
for (long long j = 1ll * i * i; j <= n; j += i){
vis[j] = 1;
}
}
}
}
int main(){
int n;
cin >> n;
get_prime(n);
int cnt = (int)prim.size();
cout << cnt;
return 0;
}
bool vis[N];改为bool vis[N] = {1, 1};
提交就报CE是什么原因?本地没问题