Cod sursa(job #303943)
Utilizator | Data | 10 aprilie 2009 15:47:55 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 0 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
var x,n,k,i:longint;
a:array[1..20000000] of byte;
f,g:text;
begin
assign(f,'ciur.in');
assign(g,'ciur.out');
reset(f); rewrite(g);
for i:=1 to n do
a[i]:=1;
a[1]:=0;
for i:=2 to n do
if (a[i]=1) then
begin
x:=2*i;
inc(k);
while x<=n do
begin
a[x]:=0;
inc(x);
end;
end;
writeln(g,k);
close(f);
close(g);
end.