Pagini recente » Cod sursa (job #2827133) | Rating UBB Gosuly Uivari Beiland (UBB_Gosuly_Uivari_Beiland) | Cod sursa (job #971169) | Cod sursa (job #687928) | Cod sursa (job #2979350)
#include <bits/stdc++.h>
using namespace std;
ifstream f("ciur.in");
ofstream g("ciur.out");
int n, nr = 1;
char a[2000001];
int main()
{
f >> n;
if (n == 1) {
nr = 0;
}
for (long long i = 3; i <= n; i += 2) {
if (!a[i]) {
nr++;
for (long long j = i * i; j <= n; j += (i << 1)) {
a[j] = 1;
}
}
}
g << nr;
g.close();
return 0;
}