Pagini recente » Cod sursa (job #1623170) | Cod sursa (job #713481) | Cod sursa (job #1552168) | Cod sursa (job #2803609) | Cod sursa (job #3284444)
#include <bits/stdc++.h>
#define oo 100101010
using namespace std;
ifstream fin("ciur.in");
ofstream fout("ciur.out");
bitset<2000005> fr;
int erato(int n)
{
int cnt = 0;
for(int i = 2; i <= n; i++)
if(fr[i] == 0)
{
cnt++;
for(int j = 2 * i; j <= n; j += i)
fr[j] = 1;
}
return cnt;
}
int main()
{
ios_base::sync_with_stdio(0);
fin.tie(0);
fout.tie(0);
int n;
fin >> n;
fout << erato(n);
return 0;
}