hdu 2040
#include<iostream>
using namespace std;
void main()
{
int t,s,n,m,k;
int qhs(int);
cin>>k;
while(cin>>n,cin>>m,k--){
t=qhs(n);
//s=qhs(t);
if(t==m)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
}
int qhs(int x)
{
int i=0,t=1;
for(i=2;i*i<x;i++)
if(x%i==0)
t+=i+x/i;
for(;i*i<=x;i++)
{if(i*i==x)
t+=i;break;}
return t;
}

浙公网安备 33010602011771号