先找出每一行的max,然后在判断这个数是不是这一列的min
#include <stdio.h>
int main()
{
int i = 0;
int i1 = 0;
int j1 = 0;
int k = 0;
int j = 0;
int arr[6][6] = { 0 };
int n = 0;
int i2 = 0;
int max = 0;
int min = 0;
scanf("%d",&n);
for( i = 0 ; i < n ; i++)
{
for( j = 0 ; j < n ; j++)
{
scanf("%d",&arr[i][j]);
}
}
for( i = 0 ; i < n ; i++)
{
max = arr[i][0];
for( j = 0 ; j < n ; j++)
{
if( max <= arr[i][j] )
{
max = arr[i][j];
i1 = i;
j1 = j;
}
}
min = arr[i1][j1];
for( k = 0 ; k < n ; k++)
{
if( min >= arr[k][j1])
{
min = arr[k][j1];
i2 = k;
}
}
if( i2 == i1 )
{
printf("%d %d\n",i1,j1);
return 0;
}
i1 = 0;
i2 = 0;
j1 = 0;
}
printf("NONE\n");
return 0;
}