Pagini recente » Cod sursa (job #1362858) | Istoria paginii problema/kangaroo | Borderou de evaluare (job #385446) | Borderou de evaluare (job #1578209) | Cod sursa (job #1473170)
#include <iostream>
#include <fstream>
#include <bitset>
using namespace std;
ifstream f("ciur.in", ios::in);
ofstream g("ciur.out", ios::out);
int ciur_eratostenes(int n) {
int sol = 0, j;
bool v[n + 1];
for(int i = 2; i <= n; i++) {
if(v[i] != 0) continue;
sol++;
for (j = i; j <= n ; j = j + i) {
v[j] = 1;
}
}
return sol;
}
int main() {
int x;
f>>x;
g<<ciur_eratostenes(x);
return 0;
}