Pagini recente » Cod sursa (job #1964473) | Cod sursa (job #1927028) | Cod sursa (job #1430087) | Rating Popescu Alin (alinpopescu02) | Cod sursa (job #2034956)
// ConsoleApplication22.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include <fstream>
#include <math.h>
using namespace std;
ifstream f("ciur.in");
ofstream g("ciur.out");
int n,cnt;
bool mark[2000001];
void verif()
{
int i,j;
for (i = 2; i <= sqrt(n); i++)
{
for (j = i; j*i <= n; j++)
{
mark[i*j] = 1;
}
}
}
int main()
{
int i;
f >> n;
verif();
for (i = 2; i <= n; i++)
if (mark[i] == 0)
cnt++;
g << cnt << endl;
return 0;
}