hdoj:2040

时间:2025-01-15 00:03:50
#include <iostream>
#include <vector> using namespace std;
vector<long> yueShu(long a)
{
vector<long> vec;
vec.push_back();
for (int i = ; i < a; i++)
{
if (a%i == )
{
vec.push_back(i);
//cout << i << " ";
}
}
return vec;
} long sum(vector<long> v)
{
long s = ;
for (int vi : v)
{
s += vi;
}
return s;
}
int main()
{
long n,a,b;
while (cin >> n)
{
while (n--)
{
cin >> a >> b;
vector<long> v1 = yueShu(a);
vector<long> v2 = yueShu(b);
long s1 = sum(v1);
long s2 = sum(v2);
if (s1 == b && s2 == a)
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}
}
}