Exile_Code @ 2023-08-27 05:06:32
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <list>
#include <string>
#include <cmath>
#include <bitset>
using namespace std;
using ll = long long;
#define LF(x) fixed << setprecision(x)
typedef pair<int, int> pii;
#define endl "\n"
int nums[125][125];
int main() {
int n; cin >> n;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
cin >> nums[i][j];
int m = -9999;
for (int i = 1; i <= n; i++) {
vector<int>num(n + 1);
//压缩矩阵
for (int j = 1; j <= n; j++)
for (int k = 1; k <= i; k++)
num[j] += nums[j][k];
//求字段和
for (int k = 1; k <= n; k++) {
num[k] = max(num[k - 1] + num[k], num[k]);
m = max(m, num[k]);
}
}
cout << m << endl;
return 0;
}