Pagini recente » Cod sursa (job #1432724) | Cod sursa (job #415365) | Cod sursa (job #395778) | Cod sursa (job #2356942) | Cod sursa (job #3215567)
//CIURUL LUI Eratosthenes ------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
const int nmax = 2e6 + 2;
ifstream fin("ciur.in");
ofstream fout("ciur.out");
int n, total;
bool ciur[nmax];
int main()
{
fin>>n;
for(int i=2;i<=n;i++){
if(ciur[i] == 0){
total ++;
for(int j=i;j<=n;j+=i){
ciur[j] = 1;
}
}
}
fout<<total;
}