Cod sursa(job #1242714)
Utilizator | Data | 14 octombrie 2014 22:01:28 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include <fstream>
using namespace std;
ifstream fi ( "ciur.in" );
ofstream fo ( "ciur.out" );
int a[2000001], x, k, i, j;
int main()
{
fi >> x;
for ( i = 2 ; i <= x ; i++ )
if ( a[i] == 0 )
{
for ( j = 2 ; j * i <= x ; j++ )
a[i*j] = 1;
k++;
}
fo << k;
return 0;
}