#K4381. Array Element-wise Multiplication
Array Element-wise Multiplication
Array Element-wise Multiplication
You are given two arrays of integers. Your task is to perform element-wise multiplication on the arrays. Specifically, if the arrays are of different lengths, the multiplication should be performed only up to the length of the shorter array.
Formally, if we denote the first array as \(a = [a_1, a_2, \ldots, a_n]\) and the second array as \(b = [b_1, b_2, \ldots, b_m]\), then the resulting array \(c\) will have \(\min(n, m)\) elements such that:
\(c_i = a_i \times b_i, \quad 1 \le i \le \min(n, m)\).
Read the input from standard input and output the result to standard output.
inputFormat
The input is provided via standard input. The first line contains an integer \(n\), the number of elements in the first array. The second line contains \(n\) space-separated integers representing the first array. The third line contains an integer \(m\), the number of elements in the second array. The fourth line contains \(m\) space-separated integers representing the second array.
outputFormat
Output a single line containing \(\min(n, m)\) integers, where each integer is the product of the corresponding elements from the two arrays. The products should be separated by a single space. If one of the arrays is empty, output nothing.
## sample3
1 2 3
3
4 5 6
4 10 18