Pagini recente » Cod sursa (job #1430557) | Cod sursa (job #155682) | Rating StanciucuCatalin (CoolYce) | Cod sursa (job #1736318) | Cod sursa (job #166646)
Cod sursa(job #166646)
var v:array[0..260000] of longint;
f,g:text;
i,n,j,nr:longint;
procedure ciur;
begin
i:=1;
while ((i*i) shl 1+(i shl 1))<=n do begin
if (v[i shr 3] shr (i and 7)) and 1=0 then begin
j:=((i*i) shl 1+(i shl 1));
while (j shl 1)+1<=n do begin {multipli devin false}
v[j shr 3]:=v[j shr 3] or (1 shl (j and 7));
j:=j+(i shl 1)+1;
end;
end;
inc(i);
end;
nr:=1;
i:=1;
while (i shl 1)+1<=n do begin
if ((v[i shr 3] shr (i and 7)) and 1=0) then
inc(nr);
inc(i);
end;
end;
begin
assign(f,'ciur.in'); reset(f);
assign(g,'ciur.out'); rewrite(g);
read(f,n);
ciur;
writeln(g,nr);
close(f); close(g);
end.