#include
#define MAX 100
int main()
{
int a[MAX][MAX];
int m, n;
int i, j;
int row_max;
int flag;
int no = 1;
printf("請輸入行數列數(以空格分隔):");
scanf("%d %d", &m, &n);
printf("請輸入%d個數:\n", m * n);
for (i = 0; i < m; i++)
for (j = 0; j < n; j++)
scanf("%d", &a[i][j]);
row_max = 0;
if (a[i][j] > a[i][row_max]) row_max = j;
flag = 1;
for (j = 0; j < m; j++)
if (a[i][row_max] > a[j][row_max])
flag = 0;
break;
}
if (flag)
printf("鞍點:(%d, %d).\n", i+1, row_max+1);
no = 0;
if (no) printf("沒有鞍點:\n");
return 0;
#include
#define MAX 100
int main()
{
int a[MAX][MAX];
int m, n;
int i, j;
int row_max;
int flag;
int no = 1;
printf("請輸入行數列數(以空格分隔):");
scanf("%d %d", &m, &n);
printf("請輸入%d個數:\n", m * n);
for (i = 0; i < m; i++)
for (j = 0; j < n; j++)
scanf("%d", &a[i][j]);
for (i = 0; i < m; i++)
{
row_max = 0;
for (j = 0; j < n; j++)
if (a[i][j] > a[i][row_max]) row_max = j;
flag = 1;
for (j = 0; j < m; j++)
if (a[i][row_max] > a[j][row_max])
{
flag = 0;
break;
}
if (flag)
{
printf("鞍點:(%d, %d).\n", i+1, row_max+1);
no = 0;
}
}
if (no) printf("沒有鞍點:\n");
return 0;
}