亲和数
#include <cstdio> int amicable(int n) { int sum = 0; for(int i = 1; i < n; ++ i) if(n % i == 0) sum += i; return sum; } int main() { int n, a, b, p, q; scanf("%d", &n); while(n --) { scanf("%d %d", &a, &b); p = amicable(a); q = amicable(b); if(p == b && q == a) printf("YES\n"); else printf("NO\n"); } return 0; }