| ||||||||||
| 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:为什么错?感觉挺好的思维就这样慌掉???求牛人帮忙解析代码,,,样例都过了In Reply To:为什么错?感觉挺好的思维就这样慌掉???求牛人帮忙解析代码,,,样例都过了 Posted by:2011014326 at 2012-10-16 02:51:52 > #include<iostream>
> using namespace std;
> int main()
> {
> int A[101][101]={0};
> int N,i,j,k;
> while(~scanf("%d",&N))
> {
> for(i=0;i<N;i++)
> {
> for(j=0;j<N;j++)
> {
> cin>>A[i][j];
> }
> }
> int B[101][101]={0};
> int max=-9999999,a,b;
>
> int s=0;
> for(j=0;j<N;j++)
> {
> for(i=0;i<N;i++)
> {
> B[i][j]=s+A[i][j];
> s=B[i][j];
> }
> s=0;
> }
>
> s=0;
> for(k=0;k<N;k++)
> {
> for(i=k;i<N;i++)
> {
> for(j=0;j<N;j++)
> {
> if(i==k)
> {
> if(A[i][j]<=0)
> s=0;
> else
> s+=A[i][j];
> }
> else
> {
> if(k==0)
> s+=B[i][j];
> else
> if(B[i][j]-B[k-1][j]<0)
> s=0;
> else
> s+=B[i][j]-B[k-1][j];
> }
>
> if(s>max)
> max=s;
> }
> s=0;
> }
> }
> cout<<max<<endl;
> }
>
> return 0;
> }
>
>
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator