daydream1ng @ 2024-12-13 22:37:18
#include <bits/stdc++.h>
using namespace std;
int fun (int a, int b){
if (a < b) swap(a, b);
if (b == 0) return a;
fun (b, a % b);
}
int main ()
{
int x, y; cin >> x >> y;
int cnt = 0;
for (int p = 1; p <= x * y; p++){
int q = x * y / p;
if (fun (p, q) == x && p * q / fun (p, q) == y)
cnt++;
}
cout << cnt << endl;
}