解题思路:
注意事项:
参考代码:
package function; import java.util.Scanner; //题目 1157: 亲和数 public class t_1157 { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); while(n!=0) { int x=sc.nextInt(),y=sc.nextInt(); int xSum=0,ySum=0; for(int i=1;i<x;i++) if(x%i==0) xSum+=i; if(xSum==y) { for(int i=1;i<y;i++) if(y%i==0) ySum+=i; if(ySum==x) System.out.println("YES"); else System.out.println("NO"); } else System.out.println("NO"); n--; } } }
0.0分
0 人评分
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:1232 |
点我有惊喜!你懂得!浏览:2074 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:495 |
C二级辅导-计负均正 (C语言代码)浏览:578 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:553 |
C语言程序设计教程(第三版)课后习题11.5 (C语言代码)浏览:619 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:1118 |
分糖果 (C++代码)浏览:1440 |
c primer plus 第十二章 12.1小节浏览:377 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:459 |