Description
Know 2 natural numbers A, B, if A + B, A-B is the number of degrees, then A, B is the natural number pair. Write A program to determine whether the given two numbers A and B are natural number pairs.
Input
The first line has an integer T, indicating that there are T groups of test data. Line 2 ~ Row T + 1 has two data records A and B, where 0 <= A + B <= 2 ^ 31 and A> B.
Output
Output a row of test data for each group, including "YES" or "NO ". "YES" indicates that the number pair is a natural number pair; otherwise, "NO" is output ".
Sample Input
2
17 8
3 1
Sample Output
YES
NO
[Plain]
# Include <stdio. h>
# Include <math. h>
Int square (int m );
Int main ()
{
Int n;
Int;
Int B;
Scanf ("% d", & n );
While (n --)
{
Scanf ("% d", & a, & B );
If (square (a-B) & square (a + B ))
{
Printf ("YES ");
}
Else
{
Printf ("NO ");
}
If (n> 0)
{
Printf ("\ n ");
}
}
Return 0;
}
Int square (int m)
{
Int I;
Int flag = 0;
I = sqrt (m );
If (I * I = m)
{
Flag = 1;
}
Return flag;
}
# Include <stdio. h>
# Include <math. h>
Int square (int m );
Int main ()
{
Int n;
Int;
Int B;
Scanf ("% d", & n );
While (n --)
{
Scanf ("% d", & a, & B );
If (square (a-B) & square (a + B ))
{
Printf ("YES ");
}
Else
{
Printf ("NO ");
}
If (n> 0)
{
Printf ("\ n ");
}
}
Return 0;
}
Int square (int m)
{
Int I;
Int flag = 0;
I = sqrt (m );
If (I * I = m)
{
Flag = 1;
}
Return flag;
}