Cod sursa(job #913357)
| Utilizator | Data | 13 martie 2013 12:56:06 | |
|---|---|---|---|
| Problema | Ciurul lui Eratosthenes | Scor | 30 |
| Compilator | fpc | Status | done |
| Runda | Arhiva educationala | Marime | 0.46 kb |
var
f,g:text;
i,j,n,k:longint;
ok:boolean;
solutie: array[1..200000] of integer;
begin
assign(f,'ciur.in');
reset(f);
assign(g,'ciur.out');
rewrite(g);
k:=1;
solutie[1]:=2;
read(f,n);
for i:=3 to n do begin
ok :=true;
for j:=1 to k do
if i mod solutie[j]=0 then begin ok:=false;
break;end;
if ok=true then begin
k:=k+1;
solutie[k]:=i;end;
end;
write(g,k);
close(f);
close(g);
end.
