Pagini recente » Cod sursa (job #61823) | Cod sursa (job #1989574) | Cod sursa (job #114651) | Cod sursa (job #920788) | Cod sursa (job #2591955)
#include <fstream>
using namespace std;
ifstream fin("ciur.in");
ofstream fout("ciur.out");
const int maxx = 2000005;
int n;
bool notPrime[maxx];
void Read()
{
fin >> n;
fin.close();
}
void Solve()
{
int cnt = 0;
for(int i = 2; i <= n; i++)
{
if(notPrime[i] == 0)
{
++cnt;
for(int j = i * 2; j <= n; j += i)
{
notPrime[j] = 1;
}
}
}
fout << cnt;
fout.close();
}
int main()
{
Read();
Solve();
return 0;
}