Kanade Doesn’t Want to Learn CG
题目链接
#include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while(t--) {
double a, b, c;
cin >> a >> b >> c;
double x0, x1, y0, y1, y2;
cin >> x0 >> x1 >> y0 >> y1 >> y2;
double tc = c - y0;
if(b * b - 4 * a * tc <= 0) {
cout << "No\n";
continue;
}
double ans1 = (-b) + sqrt(b * b - 4 * a * tc);
double ans2 = (-b) - sqrt(b * b - 4 * a * tc);
if(ans1 <= (x0 * 2 * a)) {
cout << "No\n";
continue;
}
if(ans2 < (x0 * 2 * a) && ans2 > (x1 * 2 * a)) {
cout << "Yes\n";
continue;
}
double cor = a * x1 * x1 + b * x1 + c;
if(cor < y2 && cor > y0) {
if(ans2 < (x1 * 2 * a) && ans2 > ((2 * x1 - x0) * 2 * a)) {
cout << "Yes\n";
continue;
}
}
cout << "No\n";
}
return 0;
}