#K57062. Product Except Self
Product Except Self
Product Except Self
Given an array of integers, produce an output array such that for each index i, the value at output[i] is the product of all the other elements in the array except the one at index i. In other words, for each valid i, you must compute
$$\text{output}[i] = \prod_{\substack{0 \leq j < n \\ j \neq i}} \text{nums}[j]$$You are not allowed to use the division operation in your solution.
inputFormat
The input is given via standard input. The first line contains a single integer n representing the number of elements in the array. The second line contains n space-separated integers, which are the elements of the array.
outputFormat
Output a single line to standard output containing n space-separated integers. The i-th integer should be equal to the product of all the array elements except for the one at index i.
## sample4
1 2 3 4
24 12 8 6