Cod sursa(job #1198879)
Utilizator | Data | 17 iunie 2014 15:45:20 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 30 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.47 kb |
type tabel=array[2..2000000]of longint;
var n,i,j,ciur:longint;
t:tabel;
begin
assign(input,'ciur.in');
reset(input);
read(n);
close(input);
for i:=2 to n do t[i]:=i;
for i:=2 to n do
begin
if t[i]<>0 then
begin
ciur:=ciur+1;
for j:=2 to n div i do
t[i*j]:=0;
end;
end;
assign(output,'ciur.out');
rewrite(output);
write(ciur);
close(output);
end.