407222: GYM102697 193 Quadratic Equation Factoring

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

193. Quadratic Equation Factoringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
This problem is worth 40 points.

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).

Input

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

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).

ExamplesInput
2 8 6
Output
(2x + 2)(x + 3)
(2x + 6)(x + 1)
(x + 1)(2x + 6)
(x + 3)(2x + 2)
Input
1 17 60
Output
(x + 12)(x + 5)
(x + 5)(x + 12)
Input
3 7 11
Output
-1

加入题单

算法标签: