Pagini recente » Cod sursa (job #315336) | Cod sursa (job #2299273) | Cod sursa (job #2667292) | Cod sursa (job #538557) | Cod sursa (job #1908603)
#include <cstdio>
#include <bitset>
using namespace std;
bitset <2000005> b;
int main()
{
freopen("ciur.in", "r", stdin);
freopen("ciur.out", "w", stdout);
int n;
scanf("%d", &n);
fclose(stdin);
for(int i = 4; i <= n; i += 2) b[i] = 1;
for(int i = 3; i * i <= n; i += 2)
for(int j = i * i; j <= n; j += i) b[j] = 1;
int ct = 0;
for(int i = 2; i <= n; ++i)
if(!b[i]) ct++;
printf("%d", ct);
fclose(stdout);
return 0;
}