思路:没必要真的去建立数组,按顺序便利,同时给予对应的行列即可,只用一个i 也可以用%与/去判断对应的坐标
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m) {
long num, maxVal = 0;
int x, y;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> num;
if (abs(num) > abs(maxVal)) {
x = i;
y = j;
maxVal = num;
}
}
}
cout << x + 1 << " " << y + 1 << " " << maxVal << endl;
}
return 0;
}