-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp1028.cpp
More file actions
43 lines (38 loc) · 828 Bytes
/
Copy pathp1028.cpp
File metadata and controls
43 lines (38 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<iostream>
using namespace std;
int main()
{
int t;
while(cin>>t)
{
int a[t][t];
int i,j;
for(i=0;i<t;i++)
for(j=0;j<t;j++)
cin>>a[i][j];
int m,n;
int max=0;
for(m=0;m<t;m++)
for(n=0;n<t;n++)
for(i=m;i<t;i++)
for(j=n;j<t;j++)
{
int p,q;
int b[t]={0};
for(p=m;p<=i;p++)
for(q=n;q<=j;q++)
b[p]=b[p]+a[p][q];
for(p=m;p<i;p++)
if(b[p]+b[p+1]>0)
b[p+1]=b[p]+b[p+1];
else
b[p+1]=0;
for(p=m;p<=i;p++)
if(b[p]>max)
max=b[p];
}
cout<<max<<endl;
}
return 0;
}
//TLE