Жуткое "школьное решение"...
const
nn=10;
type
arr=array[1..nn] of integer;
var
a,b,c:arr;
i,k,m,n:integer;
y:real;
procedure Kol(p:arr; k:integer; var r:integer);
var
i:integer;
begin
r:=0;
for i:=1 to k do
if (p[i]>=1) and (p[i]<=5) then r:=r+1<br>end;
begin
Randomize;
Write('A: ');
for i:=1 to 10 do begin
a[i]:=Random(16)-5;
Write(a[i],' ')
end;
Writeln;
Write('B: ');
for i:=1 to 8 do begin
b[i]:=Random(16)-5;
Write(b[i],' ')
end;
Writeln;
Write('C: ');
for i:=1 to 7 do begin
c[i]:=Random(16)-5;
Write(c[i],' ')
end;
Writeln;
Kol(a,10,k); Kol(b,8,m); Kol(c,7,n);
y:=2/3+k+Abs(m-n);
Writeln('Y = ',y)
end.