当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2394:Johnny and the Quadratic Equation

题目描述
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?
输入解释
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.
输入样例
3
948 43958 1429912782
95348 54988 345335
943428 4353958 3444096692
输出样例
YES
NO
YES
来自杭电HDUOJ的附加信息
Author 2008CEPC Warmup
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-2394

最后修改于 2020-10-25T22:53:03+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)