|
|
back to boardCommon Boardwhy i get WA#10 ??? help me?????????/ #include<stdio.h> long mx,Matrix[1010][1010],i,j,k,y,sum,dim; int main() {
while(scanf("%ld",&dim)==1) { mx=-99999;sum=0; for(i=0;i<101;i++) for(j=0;j<101;j++) Matrix[i][j]=0; for(i=1;i<=dim;i++) for( j = 1 ; j <= dim ; j++) { scanf("%ld", &Matrix[i][j]); Matrix[i][j]+= Matrix[i][j-1] + Matrix[i-1][j] - Matrix[i-1][j-1]; if(mx < Matrix[i][j]) mx = Matrix[i][j]; } for(i = 1; i <= dim ; i++) for(j = 1; j <= dim ; j++) for( y = 1; y < i ; y++) for( k = 1 ; k < j ; k++) { sum = Matrix[i][j] - Matrix[i][k-1] - Matrix[y-1][j] + Matrix[y-1][k-1]; if(mx < sum) mx = sum; sum = 0; } printf("%ld\n",mx); } return 0; } |
|
|