По разделам

 

Решение задачи Matrix 47


Дана матрица размера M × N и целые числа K1 и K2 (1 ≤ K1 < K2 ≤ M). Поменять местами строки матрицы с номерами K1 и K2.

Код (Pascal)

program Matrix47;
type
  matrix = array [1..10,1..10] of integer;
 
var
  a:matrix;
  M, N, i, j, K1, K2:Integer;
 
procedure Swap(var X,Y:Integer);
begin
  X:=X+Y;
  Y:=X-Y;
  X:=X-Y;
end;
 
procedure SwapMatrixRow(var mat:matrix; X,Y:Integer);
var
 i:integer;
begin
 for j:=1 to N do
  swap(mat[x,j], mat[y,j]);
end;
 
 
begin
 Write('N: ');
 Readln(N);
 Write('M: ');
 Readln(M);
 
 Write('K1: ');
 Readln(K1);
 Write('K2: ');
 Readln(K2);
 
 for  i:=1 to M do
  begin
   writeln(i,': ');
   for j:=1 to N do
    begin
     Write(j,' : ');
     Read(a[i,j]);
    end;
  end;
 
 SwapMatrixRow(a, K1, K2);
 
 for  i:=1 to M do
  begin
   for j:=1 to N do
    begin
     Write(' : ',a[i,j]);
    end;
   writeln(' : ');
  end;
end.
									




Matrix. Абрамян
Matrix 1 Просмотров: 12041
Matrix 2 Просмотров: 4481
Matrix 3 Просмотров: 4611
Matrix 4 Просмотров: 3485
Matrix 5 Просмотров: 5122
Matrix 6 Просмотров: 3446
Matrix 7 Просмотров: 4226
Matrix 8 Просмотров: 3249
Matrix 9 Просмотров: 4088
Matrix 10 Просмотров: 2970
Matrix 11 Просмотров: 4424
Matrix 12 Просмотров: 3120
Matrix 13 Просмотров: 3085
Matrix 14 Просмотров: 2021
Matrix 15 Просмотров: 2728
Matrix 16 Просмотров: 2621
Matrix 17 Просмотров: 4447
Matrix 18 Просмотров: 2248
Matrix 19 Просмотров: 2921
Matrix 20 Просмотров: 3346
Matrix 21 Просмотров: 3344
Matrix 22 Просмотров: 2046
Matrix 23 Просмотров: 4552
Matrix 24 Просмотров: 2268
Matrix 25 Просмотров: 2514
Matrix 26 Просмотров: 2142
Matrix 27 Просмотров: 2089
Matrix 28 Просмотров: 1982
Matrix 29 Просмотров: 1892
Matrix 30 Просмотров: 1842
Matrix 31 Просмотров: 1558
Matrix 32 Просмотров: 1437
Matrix 33 Просмотров: 1531
Matrix 34 Просмотров: 1897
Matrix 35 Просмотров: 1618
Matrix 36 Просмотров: 1671
Matrix 37 Просмотров: 1428
Matrix 38 Просмотров: 1535
Matrix 39 Просмотров: 1428
Matrix 40 Просмотров: 1476
Matrix 41 Просмотров: 1188
Matrix 42 Просмотров: 1535
Matrix 43 Просмотров: 1209
Matrix 44 Просмотров: 1211
Matrix 45 Просмотров: 1269
Matrix 46 Просмотров: 1308
Matrix 47 Просмотров: 1487
Matrix 48 Просмотров: 1294
Matrix 49 Просмотров: 1279
Matrix 50 Просмотров: 1610
Matrix 51 Просмотров: 1446
Matrix 52 Просмотров: 1435
Matrix 53 Просмотров: 1312
Matrix 54 Просмотров: 1060
Matrix 55 Просмотров: 1142
Matrix 56 Просмотров: 941
Matrix 57 Просмотров: 1116
Matrix 58 Просмотров: 1391
Matrix 59 Просмотров: 1159
Matrix 60 Просмотров: 1057
Matrix 61 Просмотров: 1101
Matrix 62 Просмотров: 1084
Matrix 63 Просмотров: 1247
Matrix 64 Просмотров: 1237
Matrix 65 Просмотров: 1114
Matrix 66 Просмотров: 971
Matrix 67 Просмотров: 1003
Matrix 68 Просмотров: 1092
Matrix 69 Просмотров: 969
Matrix 70 Просмотров: 1086
Matrix 71 Просмотров: 927
Matrix 72 Просмотров: 954
Matrix 73 Просмотров: 1020
Matrix 74 Просмотров: 1002
Matrix 75 Просмотров: 884
Matrix 76 Просмотров: 1004
Matrix 77 Просмотров: 1031
Matrix 78 Просмотров: 960
Matrix 79 Просмотров: 1014
Matrix 80 Просмотров: 2615
Matrix 81 Просмотров: 1373
Matrix 82 Просмотров: 1104
Matrix 83 Просмотров: 1469
Matrix 84 Просмотров: 968
Matrix 85 Просмотров: 1040
Matrix 86 Просмотров: 962
Matrix 87 Просмотров: 1061
Matrix 88 Просмотров: 884
Matrix 89 Просмотров: 887
Matrix 90 Просмотров: 1033
Matrix 91 Просмотров: 911
Matrix 92 Просмотров: 893
Matrix 93 Просмотров: 887
Matrix 94 Просмотров: 1060
Matrix 95 Просмотров: 886
Matrix 96 Просмотров: 962
Matrix 97 Просмотров: 990
Matrix 98 Просмотров: 1160
Matrix 99 Просмотров: 1095
Matrix 100 Просмотров: 1217

Комментарии

Чтобы написать комментарии вам нужно войти в систему или зарегистрироваться



Заявка на расчет