Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我考!,数组开[200][200],AC,开[115][115]RE,WHY?#include <stdlib.h> #include<stdio.h> int d[205][205]; int sum(int i,int j,int k) { int ans=0; for(int u=i;u<=j;u++) ans+=d[u][k]; return ans; } int main(int argc, char** argv) { int n,i,j,r,k; while(scanf("%d",&n)!=EOF) { for(i=1;i<=n;i++) for(j=1;j<=n;j++) scanf("%d",&d[i][j]); int max=d[1][1],ans; for(r=1;r<=n;r++) { for(i=1;i<=n;i++) { int j=i+r-1; ans=0; for(k=1;k<=n;k++) { ans+=sum(i,j,k); if(ans>max) max=ans; if(ans<0) ans=0; } } } printf("%d\n",max); } return (EXIT_SUCCESS); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator