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 |
Re:0ms简单易懂代码In Reply To:0ms简单易懂代码 Posted by:ls2412126 at 2014-12-07 11:44:28 > #include<iostream> > #include<stdio.h> > #include<cstring> > using namespace std; > int main() > { > > int n; > int matrix[101][101]; > int summatrix[101][101]; > while(scanf("%d",&n)!=EOF) > { > for (int ii=0;ii<n;ii++) > for (int jj=0;jj<n;jj++) > { > scanf("%d",&matrix[ii][jj]); > summatrix[ii][jj]=summatrix[ii-1][jj]+matrix[ii][jj]; > > > } > int max=-10000; > > for (int king=0;king<n;king++) > for (int queen=king;queen<n;queen++) > > { > int sum=0,d=-10000; > > for (int m=0;m<n;m++) > { > > if (sum<=0) > sum=summatrix[queen][m]-summatrix[king-1][m]; > else sum=sum+summatrix[queen][m]-summatrix[king-1][m]; > if (sum>d) > d=sum; > > > > } > > if (d>max) max=d; > > > > > > } > > > printf("%d\n",max); > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator