По разделам

 

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


Дана матрица размера M × N. Элемент матрицы называется ее локальным максимумом, если он больше всех окружающих его элементов. Поменять знак всех локальныx максимумов данной матрицы на противоположный. При решении допускается использовать вспомогательную матрицу.

Код (Pascal)

program Matrix75;
type
  matrix = array [1..10,1..10] of integer;
 
var
  a:matrix;
  K, M, N, i, j:Integer;
 
Function CheckMatrixLocMax(var mat:matrix; X,Y:Integer):Boolean;
 Begin
  CheckMatrixLocMax:=true;
  if x>1 then
   if mat[x,y]<=mat[x-1,y] then CheckMatrixLocMax:=False;
  if x1 then
   if mat[x,y]<=mat[x,y-1] then CheckMatrixLocMax:=False;
  if y1) and (x>1) then
   if mat[x,y]<=mat[x-1,y-1] then CheckMatrixLocMax:=False;
  if (y<N) and (x<M) then
   if mat[x,y]<=mat[x+1,y+1] then CheckMatrixLocMax:=False;   if (y>1) and (x<M) then
   if mat[x,y]<=mat[x+1,y-1] then CheckMatrixLocMax:=False;
  if (y<N) and (x>1) then
   if mat[x,y]<=mat[x-1,y+1] then CheckMatrixLocMax:=False;
 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;
 
 for  i:=1 to M do
   for j:=1 to N do
     if CheckMatrixLocMax(a,i,j) then a[i,j]:=(-1)*a[i,j];
 
 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 Просмотров: 3445
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 Просмотров: 2046
Matrix 23 Просмотров: 4552
Matrix 24 Просмотров: 2268
Matrix 25 Просмотров: 2514
Matrix 26 Просмотров: 2142
Matrix 27 Просмотров: 2089
Matrix 28 Просмотров: 1981
Matrix 29 Просмотров: 1892
Matrix 30 Просмотров: 1841
Matrix 31 Просмотров: 1558
Matrix 32 Просмотров: 1437
Matrix 33 Просмотров: 1531
Matrix 34 Просмотров: 1897
Matrix 35 Просмотров: 1618
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 Просмотров: 1435
Matrix 53 Просмотров: 1311
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 Просмотров: 1113
Matrix 66 Просмотров: 971
Matrix 67 Просмотров: 1002
Matrix 68 Просмотров: 1091
Matrix 69 Просмотров: 969
Matrix 70 Просмотров: 1086
Matrix 71 Просмотров: 927
Matrix 72 Просмотров: 954
Matrix 73 Просмотров: 1020
Matrix 74 Просмотров: 1001
Matrix 75 Просмотров: 882
Matrix 76 Просмотров: 1004
Matrix 77 Просмотров: 1029
Matrix 78 Просмотров: 960
Matrix 79 Просмотров: 1014
Matrix 80 Просмотров: 2615
Matrix 81 Просмотров: 1373
Matrix 82 Просмотров: 1104
Matrix 83 Просмотров: 1469
Matrix 84 Просмотров: 966
Matrix 85 Просмотров: 1040
Matrix 86 Просмотров: 962
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 Просмотров: 886
Matrix 96 Просмотров: 961
Matrix 97 Просмотров: 990
Matrix 98 Просмотров: 1159
Matrix 99 Просмотров: 1095
Matrix 100 Просмотров: 1217

Комментарии

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



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