Pagini recente » Cod sursa (job #1185655) | Profil marica_adi | Atasamentele paginii oji-verif | Istoria paginii runda/numere_reale | Cod sursa (job #2783261)
#include <bits/stdc++.h>
//int tine numere din intervalul (-2^31, 2^31)
//long long tine numere din intervalul (-2^63, 2^63)
//bool (0, 1)
using namespace std;
bool e[2000000 + 7];
int main()
{
freopen ("ciur.in", "r", stdin);
freopen ("ciur.out", "w", stdout);
int n;
cin >> n;
for (int i = 2; i <= n; i++) {
e[i] = 1;
}
for (int i = 2; i <= n; i++) {
if (e[i]) {
for (int j = 2 * i; j <= n; j += i) {
e[j] = 0;
}
}
}
int cnt = 0;
for (int i = 1; i <= n; i++) {
if (e[i] == 1) {
cnt++;
}
}
cout << cnt << "\n";
return 0;
}