a,b,c范围比较小,在(0,0)附近枚举一下可以过
#include <cstdio>
int a,b,c;
bool f(int x,int y) {
return 1LL*a*x*x+1LL*b*x*y+1LL*c*y*y < 0;
}
int main() {
while(~scanf("%d%d%d",&a,&b,&c)) {
//if (a < b) {int t = a; a = b; b = t;}
//if (f(1000,0)&&f(0,1000)||f(-1000,0)||f(0,-1000))
bool ok = 0;
for (int i = -100; i <= 100; i++)
for (int j = -100; j <= 100 && ok==0; j++)
ok |= f(i,j);
if(ok) puts("No");
else puts("Yes");
}
return 0;
}
链接:https://ac.nowcoder.com/acm/contest/1110/F
来源:牛客网
题目描述
Given function f(x,y)=ax2+bxy+cy2f(x, y) = a x^2 + b xy + c y^2f(x,y)=ax2+bxy+cy2, check if f(x,y)≥0f(x, y) \geq 0f(x,y)≥0 holds for all x,y∈Rx, y \in \mathbb{R}x,y∈R.
输入描述:
The input contains zero or more test cases and is terminated by end-of-file. Each test case contains three integers a, b, c. * −10≤a,b,c≤10-10 \leq a, b, c \leq 10−10≤a,b,c≤10 * The number of tests cases does not exceed 10410^4104.输出描述:
For each case, output "`Yes`" if f(x,y)≥0f(x, y) \geq 0f(x,y)≥0 always holds. Otherwise, output "`No`".示例1
输入
复制
1 -2 1 1 -2 0 0 0 0输出
复制
Yes No Yes