#C9720. Product of Array Except Self

    ID: 53845 Type: Default 1000ms 256MiB

Product of Array Except Self

Product of Array Except Self

You are given an array of integers \(nums\) of size \(n\). Your task is to compute an output array \(output\) such that:

\(output[i] = \prod_{\substack{0 \leq j < n \\ j \neq i}} nums[j]\)

Note: You must solve this problem without using division.

The input is provided via stdin and the resulting array should be printed on a single line, with each element separated by a space.

inputFormat

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

outputFormat

Print the resulting array on a single line, with each value separated by a space.

## sample
5
1 2 3 4 5
120 60 40 30 24