Pagini recente » Cod sursa (job #423985) | Cod sursa (job #1025761) | Cod sursa (job #2413685) | Cod sursa (job #368269) | Cod sursa (job #2969608)
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
int main()
{
freopen("ciur.in","r",stdin);
freopen("ciur.out","w",stdout);
int maxn;
cin>>maxn;
bool ciur [maxn] = {};
ciur[0]=ciur[1]=true;
int rs=0;
for(int i=2;i<maxn;i++){
if(ciur[i]==false){
rs++;
for(int j=i*2; j<maxn;j+=i)
ciur[j]=true;
}
}
cout<<rs;
return 0;
}