For each position, print the product of every other element. Solve it without division.
Input
- Line 1: n (
2 ≤ n ≤ 10^5)
- Line 2: n integers (the full product fits in a 64-bit integer)
Output
n integers separated by single spaces.
Hint
Two sweeps: one carrying the product of everything to the left, one carrying the product of everything to the right. Multiply them per position.
Read from standard input and write to standard output. 5 test cases in total (3 hidden). Tests for this language run inside your browser.