[2019牛客国庆集训派对day5 F] Simple Algebra

 

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值