C语言 《鞍点》 题目 具体要求在下面。谢啦!!☆⌒(*^-゜)v
发布网友
发布时间:2022-04-28 12:00
我来回答
共1个回答
热心网友
时间:2023-10-08 20:43
#include <stdio.h>
int main()
{
int n, m, ai[100][100], max[100], min[100], i, j;
while (scanf("%d%d", &n, &m) != EOF)
{
for (i = 0; i < n; i++)
for (j = 0; j < m; j++)
scanf("%d", &ai[i][j]);
for (i = 0; i < m; i++)
min[i] = ai[0][i];
for (i = 0; i < n; i++)
{
max[i] = ai[i][0];
for (j = 0; j < m; j++)
{
if (max[i] < ai[i][j])
max[i] = ai[i][j];
if (min[j] > ai[i][j])
min[j] = ai[i][j];
}
}
for (i = 0; i < n; i++)
{
for (j = 0; j < m; j++)
if (ai[i][j] == max[i]
&& ai[i][j] == min[j])
break;
if (ai[i][j] == max[i]
&& ai[i][j] == min[j])
break;
}
printf("%d %d %d\n", i, j, ai[i][j]);
}
return 0;
}
运行结果:
热心网友
时间:2023-10-08 20:43
#include <stdio.h>
int main()
{
int n, m, ai[100][100], max[100], min[100], i, j;
while (scanf("%d%d", &n, &m) != EOF)
{
for (i = 0; i < n; i++)
for (j = 0; j < m; j++)
scanf("%d", &ai[i][j]);
for (i = 0; i < m; i++)
min[i] = ai[0][i];
for (i = 0; i < n; i++)
{
max[i] = ai[i][0];
for (j = 0; j < m; j++)
{
if (max[i] < ai[i][j])
max[i] = ai[i][j];
if (min[j] > ai[i][j])
min[j] = ai[i][j];
}
}
for (i = 0; i < n; i++)
{
for (j = 0; j < m; j++)
if (ai[i][j] == max[i]
&& ai[i][j] == min[j])
break;
if (ai[i][j] == max[i]
&& ai[i][j] == min[j])
break;
}
printf("%d %d %d\n", i, j, ai[i][j]);
}
return 0;
}
运行结果:
热心网友
时间:2023-10-08 20:43
#include <stdio.h>
int main()
{
int n, m, ai[100][100], max[100], min[100], i, j;
while (scanf("%d%d", &n, &m) != EOF)
{
for (i = 0; i < n; i++)
for (j = 0; j < m; j++)
scanf("%d", &ai[i][j]);
for (i = 0; i < m; i++)
min[i] = ai[0][i];
for (i = 0; i < n; i++)
{
max[i] = ai[i][0];
for (j = 0; j < m; j++)
{
if (max[i] < ai[i][j])
max[i] = ai[i][j];
if (min[j] > ai[i][j])
min[j] = ai[i][j];
}
}
for (i = 0; i < n; i++)
{
for (j = 0; j < m; j++)
if (ai[i][j] == max[i]
&& ai[i][j] == min[j])
break;
if (ai[i][j] == max[i]
&& ai[i][j] == min[j])
break;
}
printf("%d %d %d\n", i, j, ai[i][j]);
}
return 0;
}
运行结果: