-->
当前位置:首页 > 题库

PROGRAMMING:Finding the local maximum of a matrix

Luz5年前 (2021-05-10)题库522
Given the integer matrix $$a $$of $$M $$row $$n $$column, if the non boundary element $$a [i] [J] $$of $$a $$is larger than the adjacent four elements, then the element $$a [i] [J] $$is said to be the local maximum of the matrix. This problem requires all local maxima of a given matrix and their positions.
###Input format:
Enter the number of rows $$M $$and the number of columns $$n $$($$3 / Le m, N / Le 20 $$) of matrix $$a $$) in the first row; Finally, $$M $$lines, each line gives the values of $$n $$elements of $$a $$in that line. Numbers are separated by spaces.
###Output format:
Each row outputs a local maximum value according to the format of "element value row number column number", in which the row and column numbers start from 1. It is required to output incrementally according to the line number; If there is more than one local maximum in the same row, the row will be output incrementally according to the column number. If there is no local maximum, output "none total rows, total columns".
###Input sample 1:
```in
4 5
1 1 1 1 1
1 3 9 3 1
1 5 3 5 1
1 1 1 1 1
```
###Output sample 1:
```out
9 2 3
5 3 2
5 3 4
```
###Input example 2:
```
3 5
1 1 1 1 1
9 3 9 9 1
1 5 3 5 1
```
###Output example 2:
```
None 3 5
```






answer:If there is no answer, please comment