#P2394. Johnny and the Quadratic Equation

    ID: 1295 远端评测题 1000ms 32MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>HDU “Valentines Day” Open Programming Contest 2009-02-14

Johnny and the Quadratic Equation

Problem Description

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<cstdio>
int main() {
        unsigned int a,b,c,x=0;
        scanf("%u %u %u",&a,&b,&c);
        do {
            if (a*x*x+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?

Input

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).

Output

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

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

Author

2008CEPC Warmup