По разделам

 

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


Дана матрица размера M × N. Поменять местами столбцы, содержащие минимальный и максимальный элементы матрицы.

Код (Pascal)

program Matrix52;
type
  matrix = array [1..10,1..10] of integer;
 
var
  a:matrix;
  MinI,MinJ, MaxI, MaxJ, M, N, i, j, K1, K2:Integer;
 
procedure Swap(var X,Y:Integer);
begin
 if x<>y then
  begin
   X:=X+Y;
   Y:=X-Y;
   X:=X-Y;
  end;
end;
 
procedure SwapMatrixColumn(var mat:matrix; X,Y:Integer);
var
 i:integer;
begin
 if x<>y then
  for i:=1 to M do
   swap(mat[i,x], mat[i,y]);
end;
 
begin
 Write('N: ');
 Readln(N);
 Write('M: ');
 Readln(M);
 
 for  i:=1 to M do
  begin
   writeln(i,': ');
   for j:=1 to N do
    begin
     Write(j,' : ');
     Read(a[i,j]);
    end;
  end;
 
 MaxI:=1;
 MaxJ:=1;
 MinI:=1;
 MinJ:=1;
 
 for  j:=1 to N do
  begin
 
   for i:=2 to M do
    begin
     if a[i,j]>a[MaxI,MaxJ] then
      begin
       MaxI:=i;
       MaxJ:=j
      end;
     if a[i,j]<a[MinI,MaxJ] then
      begin
       MinI:=i;
       MinJ:=j;
      end;
    end;
  end;
 
 SwapMatrixColumn(a, MaxJ, MinJ);
 
 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 Просмотров: 12039
Matrix 2 Просмотров: 4481
Matrix 3 Просмотров: 4611
Matrix 4 Просмотров: 3484
Matrix 5 Просмотров: 5122
Matrix 6 Просмотров: 3444
Matrix 7 Просмотров: 4226
Matrix 8 Просмотров: 3249
Matrix 9 Просмотров: 4087
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 Просмотров: 2045
Matrix 23 Просмотров: 4552
Matrix 24 Просмотров: 2268
Matrix 25 Просмотров: 2514
Matrix 26 Просмотров: 2142
Matrix 27 Просмотров: 2089
Matrix 28 Просмотров: 1980
Matrix 29 Просмотров: 1892
Matrix 30 Просмотров: 1841
Matrix 31 Просмотров: 1558
Matrix 32 Просмотров: 1437
Matrix 33 Просмотров: 1531
Matrix 34 Просмотров: 1897
Matrix 35 Просмотров: 1617
Matrix 36 Просмотров: 1671
Matrix 37 Просмотров: 1426
Matrix 38 Просмотров: 1535
Matrix 39 Просмотров: 1428
Matrix 40 Просмотров: 1476
Matrix 41 Просмотров: 1187
Matrix 42 Просмотров: 1535
Matrix 43 Просмотров: 1209
Matrix 44 Просмотров: 1210
Matrix 45 Просмотров: 1268
Matrix 46 Просмотров: 1308
Matrix 47 Просмотров: 1487
Matrix 48 Просмотров: 1293
Matrix 49 Просмотров: 1278
Matrix 50 Просмотров: 1610
Matrix 51 Просмотров: 1446
Matrix 52 Просмотров: 1434
Matrix 53 Просмотров: 1310
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 Просмотров: 1246
Matrix 64 Просмотров: 1236
Matrix 65 Просмотров: 1113
Matrix 66 Просмотров: 971
Matrix 67 Просмотров: 1001
Matrix 68 Просмотров: 1091
Matrix 69 Просмотров: 969
Matrix 70 Просмотров: 1086
Matrix 71 Просмотров: 927
Matrix 72 Просмотров: 954
Matrix 73 Просмотров: 1019
Matrix 74 Просмотров: 1000
Matrix 75 Просмотров: 882
Matrix 76 Просмотров: 1003
Matrix 77 Просмотров: 1029
Matrix 78 Просмотров: 960
Matrix 79 Просмотров: 1013
Matrix 80 Просмотров: 2614
Matrix 81 Просмотров: 1373
Matrix 82 Просмотров: 1102
Matrix 83 Просмотров: 1469
Matrix 84 Просмотров: 966
Matrix 85 Просмотров: 1040
Matrix 86 Просмотров: 959
Matrix 87 Просмотров: 1061
Matrix 88 Просмотров: 884
Matrix 89 Просмотров: 887
Matrix 90 Просмотров: 1032
Matrix 91 Просмотров: 911
Matrix 92 Просмотров: 892
Matrix 93 Просмотров: 887
Matrix 94 Просмотров: 1060
Matrix 95 Просмотров: 884
Matrix 96 Просмотров: 961
Matrix 97 Просмотров: 990
Matrix 98 Просмотров: 1159
Matrix 99 Просмотров: 1095
Matrix 100 Просмотров: 1217

Комментарии

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



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