fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. ll a[25];
  5. ll b[25];
  6. ll c[25];
  7. int main()
  8. {
  9. ios_base::sync_with_stdio(0);
  10. cout.tie(0);cin.tie(0);
  11.  
  12. int n, m; cin >> n >> m;
  13. for(int i = 1; i <= n; i++) cin >> a[i];
  14.  
  15. for(int i = 1; i <= m; i++) cin >> b[i];
  16.  
  17. for(int i = 1; i <= n; i++){
  18. for(int j = 1; j <= m; j++){
  19. c[(i - 1) + (j - 1)] += a[i] * b[j];
  20. }
  21. }
  22.  
  23. for(int i = 0; i <= n + m - 2; i++) cout << c[i] << " ";
  24. }
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
Standard output is empty