Const n=7;
begin
var a:=MatrRandom(n,n,-20,20);
a.Println(4);
var s:=0;
for var i:=0 to a.RowCount-1 do s:=s+a[i,n-i-1];
Writeln('s = ',s);
var k:=a.ElementsByRow.Where(x->x>s/3).Count;
writeln('k = ',k);
end.
Пример:
-4 -14 1 4 1 8 20
-10 -19 5 -19 -15 0 2
-11 -13 0 -15 -6 13 -11
-16 5 -18 2 19 -8 -11
10 -2 19 -10 20 8 1
9 -12 2 12 4 0 7
5 6 1 9 -5 4 -11
s = 28
k = 7