Cod sursa(job #2261483)

Utilizator mihnea.anghelMihnea Anghel mihnea.anghel Data 16 octombrie 2018 11:46:06
Problema Ciurul lui Eratosthenes Scor 30
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.32 kb
#include <fstream>

using namespace std;
ifstream f("ciur.in");
ofstream g("ciur.out");
long long n,j,i,v[2000001];

int main()
{
    f>>n;
    for(i=2;i<=n;i++)
        if(v[i]==0)
        {
            v[0]++;
            for(j=2;j*i<=n;j++)
                v[i*j]=1;
        }
    g<<v[0];
    return 0;
}