题意
模拟编辑器,还是给链接吧
https://vjudge.net/problem/HDU-4699
思路
两个栈
代码
//poj1050
//n^4暴力
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#define N 105
#define INF 0x3fffffff
using namespace std;
int a[N][N];
int sum[N];
int ans;
int main()
{
int n; scanf("%d", &n);
for (int i = ; i <= n; i++)
for (int j = ; j <= n; j++)
scanf("%d", &a[i][j]);
for (int i = ; i <= n; i++) {
memset(sym, , sizeof(sum));
for (int j = i; j <= n; j++) {
int num = ;
for (int k = ; k <= n; k++) {
num += sum[k] += a[j][k];
ans = max(ans, num);
if (num < ) num = ;
}
}
}
printf("%d\n", ans);
return ;
}