{1}
const
n = 5;
var
a: array [1..n] of integer;
i,k,x,l: integer;
t: boolean;
begin
for i := 1 to n do read(a[i]);
k := 0;
for i := 1 to n do
begin
t := true;
x := a[i]; if x < 0 then x := -x;
l := 1;
while l <= x do l := l*2; l := l div 2;<br> while t and (l > 1) do
begin
t := x >= l;
if t then x := x - l;
t := t = (x mod 2 <> 0);
x := x div 2;
l := l div 4;
end;
if t then k := k + 1
end;
write(k)
end.
{2}
const
n = 10;
var
a,d: array [1..n] of integer;
i,j,k: integer;
begin
for i := 1 to n do
a[i] := 100 + random(900);
for i := 1 to n do
begin
d[i] := 0;
for j := 1 to a[i] do
if a[i] mod j = 0 then
d[i] := d[i] + 1;
end;
for i := 1 to n-1 do
begin
k := i;
for j := i + 1 to n do
if d[j] < d[k] then k := j;
j := a[k];
a[k] := a[i];
a[i] := j;
j := d[k];
d[k] := d[i];
d[i] := j;
end;
for i := 1 to n do
write(a[i],' ')
end.
{3}
const
n = 10;
l = 3;
var
a: array [1..n] of integer;
m: array [1..l] of integer;
i,j,k: integer;
begin
for i := 1 to n do
begin
a[i] := random(1001);
write(a[i],' ')
end;
writeln;
for i := 1 to l do
m[i] := -1;
for i := 1 to n do
begin
j := 1;
while j <= l do<br> begin
if (a[i] = m[j]) then j := l else
if (a[i] < m[j]) or (m[j] = -1) then
begin
for k := l downto j+1 do
m[k] := m[k-1];
m[j] := a[i];
j := l
end;
j := j + 1
end;
end;
for i := 1 to l do
if m[i] <> -1 then write(m[i],' ')
end.