Pagini recente » Cod sursa (job #1044439) | Cod sursa (job #2696494) | Cod sursa (job #2900646) | Cod sursa (job #1046734) | Cod sursa (job #2204349)
#include <cstdio>
#include <bitset>
using namespace std;
int const NM = 2e6 + 7;
bitset <NM> v;
char const in [] = "ciur.in";
char const out [] = "ciur.out";
int best;
void ciur (int n)
{
int i , j;
for(i = 2 ; i * i <= n ; ++ i)
if(! v [i])
for(j = i * i ; j <= n ; j += i)
v [j] = 1;
for(i = 2 ; i <= n ; ++ i)
if(! v [i])
++ best;
printf ("%d" , best);
puts("");
}
int main()
{
freopen (in , "r" , stdin);
freopen (out , "w" , stdout);
int n , i , best = 0;
scanf ("%d", &n);
ciur (n);
return 0;
}