Given numbers, compute all the different results that can be obtained with the sum and product operators and adding parentheses at will. You cannot change the order of the given numbers. For instance, with 2, 1 and 3 we can get 5, 6, 8 or 9, but no other result. Some possible combinations are , , , i .
Input consists of several cases, each with , followed by natural numbers between 1 and 9. Assume .
For every case, print all the possible results in order.
Author: Unknown
Translator: Salvador Roura
Generation: 2026-01-25T11:13:37.343Z
© Jutge.org, 2006–2026.
https://jutge.org