题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2040
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 57004 Accepted Submission(s): 34670
1 #include <iostream> 2 #include <algorithm> 3 using namespace std; 4 int n,m,t; 5 int deal(int x,int y) 6 { 7 int sum=0; 8 for(int i=1;i<x;i++){ 9 if(x%i==0){ 10 sum+=i; 11 } 12 } 13 return sum==y; 14 } 15 int main() 16 { 17 while(cin>>t){ 18 while(t--){ 19 cin>>n>>m; 20 if(deal(n,m)&&deal(m,n)) cout<<"YES"<<endl; 21 else cout<<"NO"<<endl; 22 } 23 } 24 return 0; 25 }
原文:https://www.cnblogs.com/shixinzei/p/10674285.html