Problem Description
The definition of the end number: If a positive integer greater than 1 equals the sum of all the factors of its own, then it is said that the number is the end number, such as 6, 28 is the end number: 6=1+2+3;28=1+2+4+7+14.
The task is to determine the number of two positive integers.
Input
The input data contains multiple lines, the first line is a positive integer n, which indicates the number of test instances, then the N test instances, each one row, consisting of two positive integers num1 and num2, (1
Import Java.util.Scanner; Public classmain{ Public Static void Main(string[] args) {Scanner SC =NewScanner (System.inch);intt = Sc.nextint (); while(t-->0){intA = Sc.nextint ();intb = Sc.nextint ();if(A>B) {a=a^b; B=a^b; A=a^b; }intnum = Numm (A, b); System. out. println (num); } }Private Static int Numm(intAintb) {intnum =0; for(inti=a;i<=b;i++) {if( is(i)) {num++; } }returnNum }Private StaticBoolean is(intA) {intnum=1; for(intI=2; i*i<=a;i++) {if(a%i==0) {num=num+i; num=num+a/i; } }if(A==num) {//system.out.println (a); return true; }return false; }}
Hdoj (HDU) 1406 finish