不太想写,直接搜的
#include<stdio.h>
int main(){
int x0, y0, x, i = 2, k = 0;
scanf("%d%d",&x0, &y0);
if (y0 % x0 != 0) {printf("0\n"); return 0;}
x = y0 / x0;
while (x != 1)
{
while (x % i != 0) i++; k++;
while (x % i == 0) x /= i;
}
printf("%d\n", 1<<(k));
}