#C3299. Product Except Self

    ID: 46710 Type: Default 1000ms 256MiB

Product Except Self

Product Except Self

Given an integer array \(A = [a_0, a_1, \ldots, a_{n-1}]\), construct an array \(B\) of the same length such that

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

for every valid index \(i\). Note: You are not allowed to use the division operation in your solution.

inputFormat

The input is provided via standard input (stdin) as a single line containing space-separated integers. These integers represent the elements of the array \(A\).

outputFormat

Output a single line to standard output (stdout) consisting of space-separated integers. Each integer is the product of all the elements in the input array except the one at the respective index.

## sample
1 2 3 4
24 12 8 6