Quadratic equation
InterviewTime limit2sMemory limit256 MB
Given a nonzero integer Y, output nonzero integer coefficients A, B, C with absolute value at most 10^6 such that A*Y^2 + B*Y + C = 0.
- Level
Easy3 of 10
- Topics
- Math, Implementation, Brute force
- Solved
- No attempts yet
Problem
Ted has just been accepted to the university after passing the exams successfully. While preparing for the exams, Ted solved several thousand similar problems. For instance, he solved quadratic equations over and over. Now that the exams are over, he can do anything he likes, so he has decided to make up his own problems. Ted wonders why one always has to find the roots of an equation, and not the other way around: find an equation for a root. First, he decided to experiment with his favorite type of equation since the ninth grade, the quadratic equation. But he ran into a new problem: this task is not typical, and he does not know enough to solve it.
Help Ted solve this new task!
Input
The first line of the input file contains an integer , the number of test cases (). It is followed by lines, one per test case.
Each line contains one non-zero integer , the root of a quadratic equation ().
Output
The output file must contain lines, and the -th line must hold the answer to the -th test case. The answer must contain three space-separated integers , , such that the -th input number is a root of the quadratic equation .
All coefficients must be non-zero and not greater than in absolute value. If the required equation is not unique, print the coefficients of any one of them. It is guaranteed that at least one equation exists in each case.