Pagini recente » Cod sursa (job #1979686) | Cod sursa (job #354312) | Cod sursa (job #848274) | Cod sursa (job #1040278) | Cod sursa (job #1541876)
// infoarenaDFSnonRec.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include <fstream>
#define MaxN 2000005
using namespace std;
ifstream fin("ciur.in");
ofstream fout("ciur.out");
int N;
bool sieve[MaxN];
int main() {
fin >> N;
int sqrtN = sqrt(N);
for (int i = 3; i <= sqrtN; i += 2) {
for (int j = i + i + i; j <= N; j += i) {
sieve[j] = true;
}
}
int res = 1;
for (int i = 3; i <= N; i += 2)
if (!sieve[i])
++res;
fout << res;
return 0;
}