Description
Find the "Saddle Point" with m rows and n columns of two-dimensional Array, that is, the element at this position is the largest on this row, and the element on this column is the smallest, where 1 <= m, n <= 10.
Input
The input data has multiple rows. The first row has two numbers, m and n. The following rows have m rows, and each row has n numbers.
Output
Output the saddle point in the following format:
Array [I] [j] = x
X represents the saddle point, And I and j represent the array rows and column subscript of the saddle point. We stipulate that the array subscript starts from 0.
A two-dimensional array does not necessarily have a saddle point. Please output None
We guarantee that there will be no two saddle points, for example:
3 3
1 2 3
1 2 3
3 6 8
Sample Input
3 3
1 2 3
4 5 6
7 8 9
Sample Output
Array [0] [2] = 3
[Plain] # include <stdio. h>
Int main ()
{
Int I;
Int j;
Int l;
Int x;
Int y;
Int k;
Int n;
Int m;
Int flag;
Int num [10] [10];
While (scanf ("% d", & n, & m )! = EOF)
{
For (I = 0; I <n; I ++)
{
For (j = 0; j <m; j ++)
{
Scanf ("% d", & num [I] [j]);
}
}
Flag = 0;
X = 0;
Y = 0;
For (I = 0; I <n; I ++)
{
For (j = 0; j <m; j ++)
{
If (j = 0)
{
K = num [I] [j];
}
If (k <num [I] [j])
{
K = num [I] [j];
X = I;
Y = j;
}
}
For (l = 0; l <n; l ++)
{
If (k <= num [l] [y])
{
Flag = 1;
}
Else
{
Flag = 0;
Break;
}
}
If (flag)
{
Printf ("Array [% d] [% d] = % d \ n", x, y, k );
Break;
}
}
If (flag = 0)
{
Printf ("None \ n ");
}
}
Return 0;
}
# Include <stdio. h>
Int main ()
{
Int I;
Int j;
Int l;
Int x;
Int y;
Int k;
Int n;
Int m;
Int flag;
Int num [10] [10];
While (scanf ("% d", & n, & m )! = EOF)
{
For (I = 0; I <n; I ++)
{
For (j = 0; j <m; j ++)
{
Scanf ("% d", & num [I] [j]);
}
}
Flag = 0;
X = 0;
Y = 0;
For (I = 0; I <n; I ++)
{
For (j = 0; j <m; j ++)
{
If (j = 0)
{
K = num [I] [j];
}
If (k <num [I] [j])
{
K = num [I] [j];
X = I;
Y = j;
}
}
For (l = 0; l <n; l ++)
{
If (k <= num [l] [y])
{
Flag = 1;
}
Else
{
Flag = 0;
Break;
}
}
If (flag)
{
Printf ("Array [% d] [% d] = % d \ n", x, y, k );
Break;
}
}
If (flag = 0)
{
Printf ("None \ n ");
}
}
Return 0;
}