#include<stdio.h>
#define M 305
int t[M][M],sum[M][M],a[M][M];
int main()
{
int i,j,k,w,n,m;
scanf("%d %d",&n,&m);
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
scanf("%d",&a[i][j]);
sum[i][j]+=sum[i][j-1]+a[i][j];
t[i][j]=sum[i][j];
}
for(j=1;j<=m;j++){
sum[i][j]+=sum[i-1][j];
}
}
for(i=2;i<=n;i++){
for(j=2;j<=m;j++){
for(k=1;k<i;k++){
for(w=1;w<i;w++){
if(t[i][j]<t[k][w]+(sum[i][j]-sum[k][j]-sum[i][w]+sum[k][w])){
t[i][j]=t[k][w]+(sum[i][j]-sum[k][j]-sum[i][w]+sum[k][w]);
}
}
}
}
}
printf("%d\n",t[n][m]);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2176 KB |
Output is correct |
2 |
Incorrect |
0 ms |
2176 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |