2018-01-08 回答
#include #include #include int row(int a[5][5]) { int i = 0, max1 = 0, max2 = 0; for (i = 1; i a[max1][max1]) max1 = i; } for (i = 1; 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 a[max1][max1]) max1 = i; } for (i = 1; 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