Pagini recente » Cod sursa (job #1786425) | Cod sursa (job #2855806) | Cod sursa (job #1378285) | Cod sursa (job #1789359) | Cod sursa (job #1052441)
#include <cstdio>
#include <cmath>
using namespace std;
bool c[2000001];
int ciur(int n){
int lim,gogu=0;
c[0]=c[1]=1;
lim=(int)sqrt((double)n);
for(int i=4;i<=n;i=i+2){
c[i]=1;
}
for(int i=3;i<=lim;i=i+2){
if(c[i]==0){
for(int j=2*i;j<=n;j=j+i){
c[i]=1;
}
}
}
for(int i=0;i<=n;i++){
if(c[i]==0)
gogu++;
}
return gogu;
}
int main()
{
freopen("ciur.in","r",stdin);
freopen("ciur.out","w",stdout);
int n;
scanf("%d",&n);
printf("%d ",ciur(n));
return 0;
}