#include
#include
#include
int row(int a[5][5])
{
int i = 0, max1 = 0, max2 = 0;
for (i = 1; i < 5; i++)
{
if (a[i][i]>a[max1][max1])
max1 = i;
}
for (i = 1; i < 5; i++)
{
if (a[i][4 - i]>a[max2][4 - max2])
max2 = i;
}
max1 = a[max1][max1] > a[max2][4 - max2] ? max1 : max2;
return max1 + 1;
}
int col(int a[5][5])
{
int i = 0, max1 = 0, max2 = 0;
for (i = 1; i < 5; i++)
{
if (a[i][i]>a[max1][max1])
max1 = i;
}
for (i = 1; i < 5; i++)
{
if (a[i][4 - i]>a[max2][4 - max2])
max2 = i;
}
max1 = a[max1][max1] > a[max2][4 - max2] ? max1 : (4 - max2);
return max1 + 1;
}
int main()
{
int i = 0, j = 0,k=0, a[5][5] = { 0 };
srand((unsigned)time(0));//时间做种保证随机
for (i = 0; i < 5; ++i)
for (j = 0; j < 5; ++j)
{
int temp = rand() % 90 + 10;//保证两位数
int temp1 = -1;
for (k = 0; k < temp; k++)
temp1 *= -1;
temp = temp*temp1;//整数包括负数,所以用temp1把负数包括进来
a[i][j] = temp;
}
int r = row(a);
int c = col(a);
printf("%d %d", r, c);//输出的分别是行和列
system("pause");
return 0;
}