All through history, some people have been interested in the solutions of polynomial equations. As everybody knows, in the Middle Ages wizards were all around. They claimed to be able to find n solutions to any (univariate) polynomial equation of degree n. Of course, they sometimes needed to include some hocus-pocus like their magic number i, which they say is a solution to the equation x2 + 1 = 0 (the second solution being −i).
But there are a few equations, for which most ordinary wizards failed to give n distinct solutions.
Only the oldest and wisest wizards tried to be clever and bubbled something about multiplicity of
roots – but nobody can possibly understand such excuses for finding fewer than n distinct roots.
Input starts with the number of test cases t (1 <= t <= 30) in a single line. Each test case consists
of a single line that holds a series of integers (separated by single spaces). The first integer is the
degree n (0 < n <= 10) of the polynomial in question. It is followed by the n+1 coefficients a0 . . . an
(−30 <= ai <= 30, a0 != 0) to form the equation Pn = sigma{ ai xn−i } = 0.
For each test case output “Yes” on a single line (without the quotes) if the wizards have a chance
(provided they are as good as they claim) to find n distinct roots.
Print “No” on a single line (again without quotes) if there is no way any wizard can possibly find
n distinct roots.
2 2 1 1 1 2 1 2 1
Yes No
Migrated from old NTUJ.
SWERC 2008
No. | Testdata Range | Score |
---|