Const n=10; m=3;
var
a:array[1..n,1..m] of integer;
i,j,s,k:integer; p:real;
begin
Randomize;
writeln('Исходный массив:');
for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=random(81)+20;
write(a[i,j]:4);
end;
writeln;
end;
s:=0;
for i:=1 to n do
for j:=1 to m do s:=s+a[i,j];
p:=s/n*0.8;
writeln('p = ',p:5:2);
writeln('Зачислены:');
k:=0;
for i:=1 to n do
begin
s:=0;
for j:=1 to m do s:=s+a[i,j];
if s>=p then begin write(i,' '); k:=k+1; end;
end;
writeln;
writeln('k = ',k);
end.
Пример:
Исходный массив:
58 79 60
96 63 97
90 97 57
29 68 25
38 75 65
54 69 42
44 70 47
39 49 24
27 64 36
68 21 64
p = 137.20
Зачислены:
1 2 3 5 6 7 10
k = 7