2742. Johnny and the Quadratic Equation

单点时限: 10.0 sec

内存限制: 256 MB

Johnny recently learned about this whole quadratic equation thing. Being an avid young programmer,

he immediately wrote the following code that was supposed to help in his homework:

include

int main() {

unsigned int a,b,c,x=0;

scanf(“%u %u %u”,&a,&b,&c);

do {

if (axx+b*x+c==0) {

puts(“YES”);

return 0;

}

x++;

} while(x);

puts(“NO”);

return 0;

}

where all calculations are performed on unsigned 32-bit integers (in other words, modulo 232). But, well, it turned out that this code runs rather slow, even on his recently updated monster gaming rig. Maybe you could help him?

输入格式

The input contains several test cases. The rst line contains an integer t (t <= 104) denoting the number of test cases. Then t tests follow, each of them consisting of three space separated integers a, b and c (0 <=a; b; c < 232).

输出格式

For each test case output the answer of the program above.

样例

Input
3
948 43958 1429912782
95348 54988 345335
943428 4353958 3444096692
Output
YES
NO
YES

1 人解决,3 人已尝试。

2 份提交通过,共有 7 份提交。

9.9 EMB 奖励。

创建: 15 年,1 月前.

修改: 7 年,2 月前.

最后提交: 1 年,4 月前.

来源: Central European Programming Contest 2008

题目标签