Q 1157: Affinity number
Time limit: 1Sec Memory Limit: 128MB
Title Description
In his study of natural numbers, the ancient Greek mathematician Pythagoras found that the sum of all the true covariates (i.e., covariates that are not themselves) of 220 is
1+2+4+5+10+11+20+22+44+55+110 = 284.
People are surprised by such a number and call it an affine number. Generally speaking, two numbers are affine if either of them is the sum of the true divisors of the other number. Your task is to write a program that determines whether the given two numbers are affine numbers
Input
The first line of the input data contains a number M, followed by M lines, one instance per line, containing two integers A,B; where 0 <= A,B <= 600000 .
Output
For each test instance, output YES if A and B are affinity numbers, otherwise output NO.
Sample Input
|
|
Sample Output
|
|
C Code
|
|