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?