#include #include #include #include #include #include #include #include #include using namespace std; int N, _max; int A[51][51]; int solve(int x, int y); int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); #endif int i, j; cin >> N; for (i = 0; i < N; ++i) { for (j = 0; j < N; ++j) { cin >> A[i][j]; } } _max = A[0][0]; for (i = 0; i < N; ++i) { for (j = 0; j < N; ++j) { _max = max(solve(i, j), _max); } } cout << _max; #ifndef ONLINE_JUDGE while (1); #endif } int solve(int x, int y) { int i, j, nx, ny, ok1; int s, saux; saux = A[x][y]; nx = x + 1; ny = y + 1; while (nx < N && ny < N) { ok1 = 1; s = 0; for (i = x; i <= nx ; ++i) { s += A[x][y]; s += A[x][y]; } for (j = y + 1; j < ny; ++j) { s += A[x][y]; s += A[x][y]; } saux = max(saux, s); ++nx; ++ny; } return saux; }