Cod sursa(job #1737625)
Utilizator | Data | 4 august 2016 15:10:09 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include <fstream>
using namespace std;
ifstream f("ciur.in");
ofstream g("ciur.out");
bool ciur[2000002];
long long i,j,n,k;
void eratosthenes()
{
for(i=2;i<=n;i++)
{
if(ciur[i]==false) k++;
for(j=2;j*i<=n;j++)
ciur[i*j]=true;
}
g<<k;
}
int main()
{
f>>n;
eratosthenes();
return 0;
}