SHARE
TWEET

Untitled

a guest Mar 21st, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int i,j,n,m,a,s[105][105],k,i1,j1,i2,j2,sum,summax;
  6.  
  7. int main()
  8. {
  9.     cin>>n>>m>>k;
  10.     for(i=1; i<=n; i++)
  11.         for(j=1; j<=m; j++)
  12.             cin>>a, s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+a;
  13.     for(i=1; i<=k; i++)
  14.     {
  15.         cin>>i1>>j1>>i2>>j2;
  16.         sum=0;
  17.         sum=s[i2][j2]-s[i1-1][j2]-s[i2][j1-1]+s[i1-1][j1-1];
  18.         if(sum>summax)
  19.             summax=sum;
  20.     }
  21.     cout<<summax<<'\n';
  22.     return 0;
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top