Miyu original, post Please note: Reprinted from
__________ White House
Question address:
Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 1406
Description:Quantity
time limit: 2000 / 1000 MS (Java / others) memory limit: 65536 / 32768 K (Java / others)
total submission (s): 6817 accepted submission (s): 2131
Problem description
Definition of final number: if the sum of all the factors of a positive integer greater than 1 is equal to its own, it is called the final number. For example, 6 and 28 are all final numbers:6=1+2+3;28=1+2+4+7+14.
The task of this question is to determine the number of completion numbers between two positive integers.
Input
The input data contains multiple rows. The first row is a positive integer N, indicating the number of test instances. Then there are n test instances. Each instance occupies one row and consists of two positive integers num1 and num2, (1<Num1, num2<10000).
Output
For each group of test data, output the number of instances between num1 and num2 (including num1 and num2.
Sample Input
2
2 5
5 7
Sample output
0
1
Water problems, directly ignore;
Code As follows: # Include < Iostream >
# Include < Cmath >
Using Namespace STD;
Int Judge ( Int A, Int B)
{
Int N = 0 ;
If ( > B)
A ^ = B ^ = A ^ = B;
If ( 6 > = A && 6 <= B)
N ++ ;
If ( 28 > = A && 28 <= B)
N ++ ;
If ( 496 > = A && 496 <= B)
N ++ ;
If ( 8128 > = A && 8128 <= B)
N ++ ;
Return N;
}
Int Main ()
{
Int T;
Scanf ( " % D " , & T );
{
While (T -- )
{
Int A, B;
Scanf ( " % D " , & A, & B );
Printf ( " % D \ n " , Judge (a, B ));
}
}
Return 0 ;
}