[恢]hdu 2040

2011-12-14 05:05:59

地址:http://acm.hdu.edu.cn/showproblem.php?pid=2040

题意:中文。

代码:

# include <stdio.h>


int gao(int n)
{
int i, sum = 0 ;
for (i =1 ; i < n ; i++)
if (n%i==0) sum += i ;
return sum ;
}

int main ()
{
int T, a, b ;
scanf ("%d", &T) ;
while (T--)
{
scanf ("%d%d", &a, &b) ;
if (gao(a) == b && gao(b) == a)
puts ("YES") ;
else puts ("NO") ;
}
return 0 ;
}



原文地址:https://www.cnblogs.com/lzsz1212/p/2314532.html