Problem Description
With given integers a,b,c, you are asked to judge whether the following statement is true: “For any x, if a⋅x2+b⋅x2+c=0 , then x is an integer.”
Input
The first line contains only one integer T(1≤T≤2000), which indicates the number of test cases.
For each test case, there is only one line containing three integers a,b,c(−5≤a,b,c≤5).
Output
or each test case, output “YES” if the statement is true, or “NO” if not.
Example Input
3
1 4 4
0 0 1
1 3 1
Example Output
YES
YES
NO
题意
给出 a,b,c
,判断
a⋅x2+b⋅x2+c=0
是否有非整数解,若有,输出 NO
,否则输出 YES
。
这道题做的时候我们做的时候就把这到题当成分类讨论的题 也就朝着这个方向去做 但是后来我们没能找出(0 0 0 )这个坑来,所以着重也没能做出来 后来补这道题的时候依然没能找出坑来 自己的代码过于杂乱 所以找了一个模板以便参考
AC 代码
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43