Pagini recente » Cod sursa (job #2476919) | Cod sursa (job #1638766) | Cod sursa (job #2863340) | Cod sursa (job #827075) | Cod sursa (job #3139085)
#include <iostream>
#include <fstream>
using namespace std;
int x, total, limit;
short v[2000002];
int main() {
ifstream fin("ciur.in");
ofstream fout("ciur.out");
fin >> x;
limit = x / 2;
for(int i = 2; i <= limit; i++) {
if (v[x] == 0) {
total ++;
for(int j = x; j <= limit; j += x) {
v[j] = 1;
}
}
}
fout << total << std::endl;
fin.close();
fout.close();
return 0;
}