SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long int
  4. int main()
  5. {
  6.     ll t,d=1;
  7.     cin>>t;
  8.     while(t--)
  9.     {
  10.  
  11.         ll n,m;
  12.         cin>>n>>m;
  13.         ll a[n+1],b[m+1];
  14.         for(ll i=1;i<=n;i++)
  15.         {
  16.             cin>>a[i];
  17.         }
  18.         for(ll j=1;j<=m;j++)
  19.         {
  20.             cin>>b[j];
  21.         }
  22.         ll q;
  23.         cin>>q;
  24.         for(ll s=0;s<q;s++)
  25.         {
  26.             ll i,j,k,l,sum=0;
  27.             cin>>i>>j>>k>>l;
  28.             if(s==0)
  29.                 cout<<"Case "<<d<<":"<<endl;
  30.  
  31.             for(ll x=i;x<=j;x++)
  32.             {
  33.                 for(ll y=k;y<=l;y++)
  34.                 {
  35.                     sum+=a[x]*b[y];
  36.                 }
  37.             }
  38.  
  39.             cout<<sum<<endl;
  40.  
  41.         }
  42.         d++;
  43.     }
  44. }
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