#include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<iostream> #include<algorithm> //#include <bits/stdc++.h> using namespace std; int gcd(int a,int b) { if(a<b) { int temp=a; a=b; b=temp; } while(b!=0) { int temp=a%b; a=b; b=temp; } return a; } int main() { int x,y; while(scanf("%d %d",&x,&y)!=EOF) { int sum=0; int j; for(int i=x; i<=y; i++) { if(x*y%i==0) { j=x*y/i; } if(gcd(i,j)==i) { sum++; } } printf("%d\n",sum*2); } } |
Double click to view unformatted code.