Pagini recente » Cod sursa (job #2782295) | Cod sursa (job #267208) | Cod sursa (job #165195) | Cod sursa (job #2633970) | 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;
}