Mai intai trebuie sa te autentifici.
Cod sursa(job #606934)
Utilizator | Data | 10 august 2011 14:23:41 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 0 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
Program Eratostene;
var T:array[1..2000000] of 0..1;
p,nr,i,j,n,x:longint;
f1,f2:text;
begin
assign(f1,'ciur.in'); reset(f1);
assign(f2,'ciur.out'); rewrite(f2);
readln(f1,n);
p:=0;
for i:=2 to n div 2 do
for j:=2 to n div i do
T[i*j]:=1;
for i:=1 to n do
if T[i]=0 then inc(nr);
writeln(f2,nr);
close(f1); close(f2);
end.