Pagini recente » Cod sursa (job #1456728) | Cod sursa (job #692532) | Cod sursa (job #1022006) | Cod sursa (job #2946134) | Cod sursa (job #188937)
Cod sursa(job #188937)
var f,f2:text;
ciur:array[1..2000000] of boolean;
j,i,n,rez,b:longint;
begin
assign(f,'ciur.in');
assign(f2,'ciur.out');
reset(f);
readln(f,n);
close(f);
rez:=0;
for i:=2 to n do
begin
if not ciur[i] then
begin
rez:=rez+1;
j:=2;
b:=i*j;
while b<=n do
begin
ciur[b]:=true;
j:=j+1;
b:=i*j;
end;
end;
end;
rewrite(f2);
writeln(f2,rez);
close(f2);
end.