#C11353. Product of Array Except Self

    ID: 40660 Type: Default 1000ms 256MiB

Product of Array Except Self

Product of Array Except Self

Given an array of n integers (where n > 1), compute an output array such that each element at index i is the product of all the elements of the input array except the element at index i. In other words, the output should satisfy:

$$output_i = \prod_{\substack{j=0 \\ j\neq i}}^{n-1} nums_j$$

You are not allowed to use division in your solution.

inputFormat

The first line of input contains an integer n, the number of elements in the array. The second line contains n space-separated integers representing the array elements.

outputFormat

Print a single line containing n space-separated integers, where the i-th integer is the product of all elements of the input array except the one at index i.

## sample
4
1 2 3 4
24 12 8 6