daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int res[100001000];
  5. int main()
  6. {
  7.     int n[10100],n1[10100];
  8.     int t,p,k,i,j;
  9.     cin >> t;
  10.     while(t--)
  11.     {
  12.         cin >> p;
  13.         for(i=0; i<p+1; i++)
  14.         {
  15.             cin >> n[i];
  16.         }
  17.         for(i=0; i<p+1; i++)
  18.         {
  19.  
  20.             cin >> n1[i];
  21.         }
  22.         for(i=0,k=p*2; i<p+1; i++)
  23.         {
  24.  
  25.             for(j=0; j<p+1; j++,k--)
  26.             {
  27.                 res[k] +=n[i]*n1[j];
  28.             }
  29.             k=p*2-i-1;
  30.         }
  31.         for(k=p*2; k>=0; k--)
  32.         {
  33.             if(k!=0)
  34.                 cout << res[k] << " " ;
  35.             else
  36.                 cout << res[k] << endl;
  37.         }
  38.         memset(res,0,sizeof(res));
  39.     }
  40.     return 0 ;
  41. }
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