Description
There are two integers, they add up equal to an integer, multiply and equal to another integer, whether they are true or false, that is, this integer does not exist, it is a bit doubt, you can quickly answer. Seems to be programmed only.
For example:
x + y = 9,x * y = 15? No such integer x and y are found
1+4=5,1*4=4, so, add up equals 5, multiply up equals 4 of two integers are 1 and 4
7+ (-8) =-1,7* (-8) =-56, so, add up equals-1, multiply equals-56 of two integers are 7 and 8
Input
The input data is an integer that appears in pairs n,m (-10000
#include <stdio.h>
#include <math.h>
int main ()
{
int n,m,d,x,y;
while (scanf ("%d%d", &n,&m)!=eof)
{
if (!n&&!m) break
;
D=n*n-4*m;
if (d<0)
{
printf ("no\n");
Continue;
}
X=int ((N+sqrt ((double) d)/2.0);//here is not-n ....
Y=int ((N-sqrt ((double) d))/2.0);
printf ("%d%d\n", x, y);
if (x+y==n&&x*y==m)
printf ("yes\n");
else
printf ("no\n");
}
return 0;
}