题目:hdu oj 2002
思路:定义一个存储最大绝对值的变量,用两个循环模拟行和列,在输入分数时找出最大值,行,列。
vs2019运行:
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
int main()
{
int m, n;
while (scanf("%d %d", &m, &n) != EOF) {
int score, abs_of_max;
int line, row;
for(int i=0;i<m;i++)
for (int j = 0; j < n; j++) {
scanf("%d", &score);
if ( (i == 0 && j == 0) || abs(score) > abs(abs_of_max))
{
abs_of_max = score;
line = i + 1, row = j + 1;
}
}
printf("%d %d %d\n", line, row, abs_of_max);
}
return 0;
}