//Блок-схема во вложении
//Pascal ABC.NET v3.1 сборка 1172
Var
ma:array of array of integer;
i,j,r,n,m,s:integer;
begin
randomize;
readln(n);
readln(m);
setlength(ma,n);
for i:=0 to n-1 do
setlength(ma[i],m);
writeln('Matrix:');
for i:=0 to n-1 do
begin
writeln;
for j:=0 to m-1 do
begin
ma[i,j]:=random(50);
write(ma[i,j]:4);
end;
end;
writeln;
writeln('Res:');
for i:=0 to n-1 do
begin
for j:=0 to m-1 do
s:=s+ma[i,j];
writeln(i+1,' ',s);
s:=0;
end;
end.
Пример ввода:
10
15
Пример вывода:
Matrix:
12 1 21 15 36 30 12 13 46 40 22 48 20 48 7
48 37 49 25 37 41 29 23 34 45 38 14 21 13 3
48 27 29 26 18 28 24 20 21 41 18 10 48 8 46
5 7 48 9 31 46 35 11 36 41 33 28 37 20 47
15 41 0 43 42 44 19 44 30 29 24 16 28 34 18
30 31 14 37 39 30 16 11 32 6 13 16 42 35 35
0 37 49 23 25 27 10 5 16 2 36 13 18 30 7
30 6 26 18 11 1 14 49 31 17 49 29 17 37 28
28 26 8 44 28 36 16 5 8 41 19 25 47 35 2
17 48 31 25 26 6 39 24 23 33 35 37 18 6 26
Res:
1 371
2 457
3 412
4 434
5 427
6 387
7 298
8 363
9 368
10 394