| CodeRams Practice Problem Archive |
|---|
| Finished |
You're given a quadratic equation, in the form of $$$y = ax^2 + bx + c$$$. Your task is to find all possible factorizations of this quadratic equation, using only positive integers. In other words, you have to find all pairs of binomials $$$cx + d$$$, where $$$c$$$ and $$$c$$$ are both positive integers, such that the product of the two binomials is the original quadratic equation.
Sort the factorizations in ASCII order (you can use your language's built-in sorting method).
The only line of input contains three space-separated positive integers $$$a$$$, $$$b$$$, and $$$c$$$: the coefficient on the $$$x$$$ term of the quadratic equation, and the constant term of the quadratic equation, respectively.
Output all of the integer factorizations of the given quadratic equation, each on a new line. Each one should be in the format $$$(x + c1)(x + c2)$$$.
If there are no possible factorizations, output "-1" (no quotes).
2 8 6
(2x + 2)(x + 3) (2x + 6)(x + 1) (x + 1)(2x + 6) (x + 3)(2x + 2)
1 17 60
(x + 12)(x + 5) (x + 5)(x + 12)
3 7 11
-1
| Name |
|---|


