Pagini recente » Cod sursa (job #723213) | Cod sursa (job #2313340) | Cod sursa (job #736728) | Cod sursa (job #1120656) | Cod sursa (job #2662914)
#include <iostream>
#include <cstdio>
using namespace std;
const int NMAX = 2000000;
const int BASE = 64;
long long ciur[NMAX / (2 * BASE) + 1];
int main() {
freopen("ciur.in", "r", stdin);
freopen("ciur.out", "w", stdout);
int n, ans = 1;
scanf("%d", &n);
for(int i = 3; i <= n; i += 2)
if(!( ciur[(i >> 1) / BASE] & ((long long)1 << ((i >> 1) % BASE)) )) {
ans++;
if(i <= n / i)
for(int j = i * i; j <= n; j += (i << 1))
ciur[(j >> 1) / BASE] |= ((long long)1 << ((j >> 1) % BASE));
}
printf("%d", ans);
return 0;
}