По разделам

 

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


Дана матрица размера M × N. Упорядочить ее столбцы так, чтобы их последние элементы образовывали убывающую последовательность.

Код (Pascal)

program Matrix77;
type
  matrix = array [1..10,1..10] of integer;
 
var
  a:matrix;
  M, N, N2, i, j, j2: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;
 
 N2:=N;
 for j:=1 to N-1 do
  begin
   j2:=1;
   N2:=N2-1;
   while (j2<=N2) do
    begin
     if a[M,j2]<a[M,j2+1] then
      begin
       SwapMatrixColumn(a, j2, j2+1);
      end;
     inc(j2);
    end;
   end;
 
 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 Просмотров: 11744
Matrix 2 Просмотров: 4308
Matrix 3 Просмотров: 4441
Matrix 4 Просмотров: 3317
Matrix 5 Просмотров: 4963
Matrix 6 Просмотров: 3295
Matrix 7 Просмотров: 4054
Matrix 8 Просмотров: 3088
Matrix 9 Просмотров: 3968
Matrix 10 Просмотров: 2821
Matrix 11 Просмотров: 4288
Matrix 12 Просмотров: 2993
Matrix 13 Просмотров: 2937
Matrix 14 Просмотров: 1884
Matrix 15 Просмотров: 2570
Matrix 16 Просмотров: 2456
Matrix 17 Просмотров: 4292
Matrix 18 Просмотров: 2109
Matrix 19 Просмотров: 2769
Matrix 20 Просмотров: 3186
Matrix 21 Просмотров: 3207
Matrix 22 Просмотров: 1943
Matrix 23 Просмотров: 4417
Matrix 24 Просмотров: 2170
Matrix 25 Просмотров: 2344
Matrix 26 Просмотров: 2018
Matrix 27 Просмотров: 1979
Matrix 28 Просмотров: 1880
Matrix 29 Просмотров: 1790
Matrix 30 Просмотров: 1737
Matrix 31 Просмотров: 1469
Matrix 32 Просмотров: 1337
Matrix 33 Просмотров: 1433
Matrix 34 Просмотров: 1768
Matrix 35 Просмотров: 1491
Matrix 36 Просмотров: 1571
Matrix 37 Просмотров: 1306
Matrix 38 Просмотров: 1402
Matrix 39 Просмотров: 1330
Matrix 40 Просмотров: 1350
Matrix 41 Просмотров: 1098
Matrix 42 Просмотров: 1443
Matrix 43 Просмотров: 1113
Matrix 44 Просмотров: 1117
Matrix 45 Просмотров: 1154
Matrix 46 Просмотров: 1213
Matrix 47 Просмотров: 1380
Matrix 48 Просмотров: 1171
Matrix 49 Просмотров: 1192
Matrix 50 Просмотров: 1512
Matrix 51 Просмотров: 1352
Matrix 52 Просмотров: 1339
Matrix 53 Просмотров: 1196
Matrix 54 Просмотров: 983
Matrix 55 Просмотров: 1047
Matrix 56 Просмотров: 843
Matrix 57 Просмотров: 1029
Matrix 58 Просмотров: 1275
Matrix 59 Просмотров: 1048
Matrix 60 Просмотров: 971
Matrix 61 Просмотров: 1006
Matrix 62 Просмотров: 989
Matrix 63 Просмотров: 1136
Matrix 64 Просмотров: 1139
Matrix 65 Просмотров: 1014
Matrix 66 Просмотров: 854
Matrix 67 Просмотров: 887
Matrix 68 Просмотров: 992
Matrix 69 Просмотров: 870
Matrix 70 Просмотров: 987
Matrix 71 Просмотров: 823
Matrix 72 Просмотров: 862
Matrix 73 Просмотров: 938
Matrix 74 Просмотров: 890
Matrix 75 Просмотров: 785
Matrix 76 Просмотров: 909
Matrix 77 Просмотров: 928
Matrix 78 Просмотров: 867
Matrix 79 Просмотров: 919
Matrix 80 Просмотров: 2495
Matrix 81 Просмотров: 1261
Matrix 82 Просмотров: 969
Matrix 83 Просмотров: 1361
Matrix 84 Просмотров: 868
Matrix 85 Просмотров: 941
Matrix 86 Просмотров: 873
Matrix 87 Просмотров: 962
Matrix 88 Просмотров: 775
Matrix 89 Просмотров: 785
Matrix 90 Просмотров: 943
Matrix 91 Просмотров: 812
Matrix 92 Просмотров: 770
Matrix 93 Просмотров: 796
Matrix 94 Просмотров: 942
Matrix 95 Просмотров: 777
Matrix 96 Просмотров: 879
Matrix 97 Просмотров: 894
Matrix 98 Просмотров: 1037
Matrix 99 Просмотров: 1010
Matrix 100 Просмотров: 1126

Комментарии

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



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