import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String args[]) throws IOException {
int m;
int a[] = new int[1000];
int b[] = new int[1000];
int c[] = new int[1000];
Scanner in=new Scanner(System.in);
m = in.nextInt();
for (int i=0;i<m;i++)
{
Scanner in2 = new Scanner(System.in);
a[i] = in2.nextInt();
Scanner in3 = new Scanner(System.in);
b[i] = in3.nextInt();
}
for (int i=0;i<m;i++){
if ((sum_ys(a[i])==b[i])&&(sum_ys(b[i])==a[i]))
c[i]=1;
else c[i]=0;;//c[]是判定是否为亲密数对
}
for (int i=0;i<m;i++){
if (c[i]==1){
System.out.printf("YES\n");}
if (c[i]==0){
System.out.printf("NO\n");}
}
}
public static int sum_ys(int a){
int i,sum=0;
for (i=2;i<=Math.sqrt(a);i++)
{
if (a%i==0)
sum=sum+(a/i)+i;
}
return sum+1;
}
}
3
最新推荐文章于 2024-08-09 10:15:34 发布