Pagini recente » Cod sursa (job #376015) | Clasament simulare_de_oni_9 | Cod sursa (job #3207355) | Cod sursa (job #2646678) | Cod sursa (job #2469173)
#include <fstream>
#include <cmath>
#include <bitset>
#define ARR_MAX 100005
using namespace std;
ifstream fin("ciur.in");
ofstream fout("ciur.out");
bitset<ARR_MAX> check;
int k;
int Ciur(int x)
{
int sol = 1;
for(int i = 1; ((i * i) << 1) + (i << 1) <= x; i += 1)
if(!check[i]){
for(int j = ((i * i) << 1) + (i << 1); (j << 1) + 1 <= x; j += (i << 1) + 1)
check[j] = 1;
}
for(int i = 1; 2 * i + 1 < x; ++i)
if(!check[i])
sol++;
return sol;
}
int main()
{
fin >> k;
fout << Ciur(k);
}