Finish number
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 22289 Accepted Submission (s): 8150
Problem description Definition: If a positive integer greater than 1 equals the sum of all the factors equal to its own, then the number is said to be the number, such as 6, 28 is the completion of the number: 6=1+2+3;28=1+2+4+7+14.
The task is to determine the number of two positive integers.
Input data contains multiple lines, the first line is a positive integer n, which indicates the number of test instances, then n test instances, each of which consists of two positive integers num1 and num2, (1<num1,num2<10000).
Output for each set of test data, print out the number of NUM1 and num2 (including NUM1 and num2) that exist.
Sample Input22 55 7
Sample Output01
1#include <iostream>2#include <cstdio>3 using namespacestd;4 int_is (intx)5 {6 inti,j,k,l,sum=1;7 for(i=2; i<=x/2; i++)8 {9 if(x%i==0)Ten { Onesum+=i; A } - } - if(sum==x) the return 1; - return 0; - } - intMain () + { - intX,y,i,j,n; +Cin>>N; A while(n--) at { - intCount=0; -scanf"%d%d",&x,&y); - if(x>y) - { - intT; int=x; -x=y; toy=T; + } - for(i=x;i<=y;i++) the { * if(_is (i)) $ {Panax Notoginsengcount++; - } the } +printf"%d\n", count); A } the +}
Because the exchange of several wrong .... And the pit point is num1 can be greater than num2