• ИНФОРМАТИКА СРОЧНО ПСКАЛЬ!!!!!!!!!!!!!!!!!!!!

Ответы 1

  • не знаю работает ли это const N = 10; M = 10; var a: array[1..N,1..M] of Integer; i, j: Integer; function CheckRowAscending(row: Integer): Boolean; var i: Integer; begin CheckRowAscending := true; for i := 2 to M do if a[row, i-1] > a[row, i] then begin CheckRowAscending := false; Exit; end; end; function CheckColumnDescending(column: Integer): Boolean; var i: Integer; begin CheckColumnDescending := true; for i := 2 to N do if a[i-1, column] < a[i, column] then begin CheckColumnDescending := false; Exit; end; end; begin {initialize the array with some values} for i := 1 to N do for j := 1 to M do a[i, j] := Random(10); {check if the row is sorted in ascending order} for i := 1 to N do if not CheckRowAscending(i) then begin Writeln('Row ', i, ' is not sorted in ascending order'); Writeln('First element to break sequence is at (', i, ',', j, ')'); Exit; end; {check if the column is sorted in descending order} for j := 1 to M do if not CheckColumnDescending(j) then begin Writeln('Column ', j, ' is not sorted in descending order'); Writeln('First element to break sequence is at (', i, ',', j, ')'); Exit; end; end.
  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years