Cod sursa(job #673911)
Utilizator | Data | 5 februarie 2012 10:37:09 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.25 kb |
#include<fstream.h>
using namespace std;
ifstream f("ciur.in");
ofstream g("ciur.out");
int n,i,j,q,v[2000002];
int main(){
f>>n;
for(i=2;i<=n;i++)
{
if(v[i]==0)
{
q++;
for(j=i+i;j<=n;j+=i)
{
v[j]=1;
}
}
}
g<<q;
}