Pagini recente » Cod sursa (job #2169687) | Cod sursa (job #1994873) | Cod sursa (job #2908899) | Cod sursa (job #2413803) | Cod sursa (job #2662911)
#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 / (2 * BASE)] & ((long long)1 << ((i / 2) % BASE)) )) {
ans++;
for(int j = 3 * i; j <= n; j += 2 * i)
ciur[j / (2 * BASE)] |= ((long long)1 << ((j / 2) % BASE));
}
printf("%d", ans);
return 0;
}