Cod sursa(job #1198881)
| Utilizator | Data | 17 iunie 2014 15:47:05 | |
|---|---|---|---|
| Problema | Ciurul lui Eratosthenes | Scor | 100 |
| Compilator | fpc | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
type tabel=array[2..2000000]of boolean;
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]:=true;
for i:=2 to n do
begin
if t[i]<>false then
begin
ciur:=ciur+1;
for j:=2 to n div i do
t[i*j]:=false;
end;
end;
assign(output,'ciur.out');
rewrite(output);
write(ciur);
close(output);
end.