Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:0ms简单易懂代码

Posted by 20132430107 at 2015-04-23 14:42:25 on Problem 1050
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator