#K71232. Product Except Self
Product Except Self
Product Except Self
Given an array of integers, your task is to compute a new array where each element at index \(i\) is equal to the product of all the numbers in the original array except the one at \(i\). In other words, for an input array \(a = [a_0, a_1, \dots, a_{n-1}]\), you need to output an array \(b\) such that
[ b_i = \prod_{\substack{0 \leq j < n \ j \neq i}} a_j ]
Note: You are not allowed to use the division operation in your solution. The input is provided via standard input (stdin) and the output must be printed to standard output (stdout).
inputFormat
The first line of input contains an integer \(n\) which represents the number of elements in the array. If \(n > 0\), the second line contains \(n\) integers separated by spaces, representing the elements of the array. If \(n = 0\), the array is empty.
outputFormat
Output a single line containing the resulting array. The numbers should be separated by a single space. If the input array is empty, output nothing.
## sample5
1 2 3 4 5
120 60 40 30 24
</p>