//如果一个数是一行中的最小值,同时又是一列中的最大值,
//则我们称这个数为一个二维数组的鞍点,那么现在输入一个二维数组,请你找出这个数组的鞍点
#define ROW 4
#define COLUMN 5
void getAnPoint(int a[][COLUMN])
{
if (a==NULL)
return;
for (int i=0; i<ROW; i++)
{
int index1 = 0x80000000;
int min_row = a[i][0];
for (int j=0; j<COLUMN; j++)
{
if (min_row>a[i][j]) {
min_row=a[i][j];
index1 = j;
}
}
int max_column = 0x80000000;
int index2 = 0x80000000;
for (int k=0; k<ROW; k++)
{
if (max_column<a[k][index1]) {
index2 = k;
max_column = a[k][index1];
}
}
if (max_column == min_row)
cout <<"<"<<index2<<","<<index1<<">"<<endl;
}
}
void main()
{
int a[][5] = { {50,40,60,70,80}, {11,3,5,9,6},
{1,2,5,7,9}, {300,100,900,300,700} };
getAnPoint(a);
}