Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int counter=0,i;
- long int a,b;
- scanf("%ld %ld",&a,&b);
- if(a==b)
- printf("infinity");
- else if(a-b < b)
- printf("0");
- else
- {
- for(i=1; i<= sqrt(a-b) ; i++)
- {
- if((a-b)%i == 0)
- {
- if(i<=b && i<sqrt(a-b) && (a-b)/i >b)
- counter++;
- else if(i<=b && i==sqrt(a-b) && (a-b)/i >b)
- continue;
- else if(i<=b && (a-b)/i >b)
- counter++;
- else if(i==sqrt(a-b) && (a-b)/i >b)
- counter++;
- else if(i>b && (a-b)/i >b)
- counter= counter + 2;
- }
- }
- printf("%d",counter);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement