1 #include <iostream> 2 #include <algorithm> 3 #include <vector> 4 #include <cstdio> 5 6 #define MAX 20 + 3 7 8 using namespace std; 9 10 const int dx[] = {-1,1,0,0}; 11 const int dy[] = {0,0,-1,1}; 12 13 int main(){ 14 int n,m; 15 while( cin>>n>>m && n && m ){ 16 int pos[MAX][MAX] = {0}; 17 for(int i = 1; i <= n; i ++ ) 18 for(int j = 1; j <= m ; j ++ ) 19 cin>>pos[i][j]; 20 21 int value[MAX][MAX] = {0}; 22 for(int i = 1; i <=n ; i ++ ){ 23 for(int j = 1; j <=m; j ++){ 24 for(int k = 0; k < 4; k ++ ){ 25 if(pos[ i+dx[k] ][ j+dy[k] ]*pos[i][j] < 0) value[i][j] += abs(pos[ i+dx[k] ][ j+dy[k] ]); 26 else value[i][j] -= abs(pos[ i+dx[k] ][ j+dy[k] ]); 27 } 28 } 29 } 30 31 int maxV = -1<<30, idx,idy; 32 for(int i = 1; i <= n; i ++ ){ 33 for(int j = 1; j <= m ; j ++ ){ 34 if(maxV < value[i][j]){ 35 maxV = value[i][j]; 36 idx = i; 37 idy = j; 38 } 39 } 40 } 41 cout<<idx << " "<<idy<<" "<<maxV<<endl; 42 } 43 44 return 0; 45 }