Question one hundred and forty: Saddle Point

Source: Internet
Author: User

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;
}



 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.