Cod sursa(job #869549)
Utilizator | Data | 1 februarie 2013 19:32:47 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.29 kb |
#include <iostream>
#include <fstream>
using namespace std;
bool ciur[2000005];
int main()
{
ifstream f("ciur.in");
ofstream g("ciur.out");
int n,m,l,j;
f>>n;
m=0;
for(l=2;l<=n;l++)
if(!ciur[l]){
for(j=l+l;j<=n;j+=l)
ciur [j]=1;}
g<<m;
return 0;
}