Pagini recente » Cod sursa (job #1360969) | Cod sursa (job #1429965) | Cod sursa (job #1809272) | Cod sursa (job #1648112) | Cod sursa (job #1562863)
#include <cstdio>
#include <bitset>
using namespace std;
const int nmx = 2000002;
int n,total;
bitset <nmx> viz;
int main() {
freopen("ciur.in", "r", stdin);
freopen("ciur.out", "w", stdout);
scanf("%d", &n);
if(n >= 2)
++ total;
for(int i = 3; i <= n; i += 2)
if(not viz[i]) {
++ total;
for(int j = 2 * i; j <= n; j += i)
viz[j] = true;
}
printf("%d\n", total);
return 0;
}