[BOJ 11317] Roots! Really?

View as PDF

Submit solution

Points: 2
Time limit: 1.0s
Memory limit: 256M

Problem type
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

A quadratic equation</p>

[ax^2 + bx + c = 0]

has two solutions (x_{+}) and (x_{−}), called roots, which are given by

[x_{\pm} = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}]

The two roots may be real or complex, and they may be identical or distinct. Given a quadratic equation and an interval [(s), (t)] (with (s) ≤ (t)), we want to know if the equation has a real root in the interval [(s), (t)]. That is, is it the case that (s) ≤ (r) ≤ (t) where (r) is any of the roots (x_{−}) or (x_{+})?

입력 형식

The first line of the input contains an integer, N, the number of test cases (1 ≤ N ≤ 1, 000). Then follows N lines, each containing five integers, (a), (b), (c), (s), and (t), with −107 ≤ (a), (b), (c), (s), (t) ≤ 107 , (a) ≠ 0, and (s) ≤ (t).

출력 형식

For each of the N test cases, output “Yes” if the equation (ax^2 + bx + c = 0) has a real root in the interval [(s), (t)]. Output “No” otherwise.

예제 입력

3
1 0 0 -1 0
-1 5 -4 2 3
4 4 1 0 100

예제 출력

Yes
No
No

Comments

There are no comments at the moment.