Sorry if I'm not always using the right words, I'm not a native English speaker. I am working on an algorithm but it's just brute force at the moment and I'm a bit stuck right now...
Consider this equation with $n$ variables: $x_1 + x_2 + \ldots + x_n = 0$
We also have a set $A = \{a_1, a_2, \ldots,a_m\}$ containing $m$ possible values for $x_1 \ldots x_n$ with $m > n$ and $a_m \in \mathbb{R}$.
Any value can only be used once. Also, using the same values but in different locations is considered a distinct solution.
As an example, we have the equation $x_1 + x_2 + x_3 = 0$ and the set $A=\{-5, 0, 2, 3, 5\}$. There are obviously multiple solutions, e.g. $$\begin{eqnarray}5+0-5=0\\0+5-5=0\\2+3-5=0\end{eqnarray}$$ and so on.
For small values of $n$ and $m$ the solutions can quickly be found by checking all combinations with brute force, but I want to be able to also do this for larger values like $n = 10$, $m = 200$.
Is there an efficient method for this? I'm not using Python or other languages with special math packages, but usually code in C or J.