hhy8399 @ 2024-08-23 23:57:28
#include <bits/stdc++.h>
using namespace std;
int x,y,ans;
int pd[10000][10000];
int lcm(int a, int b)
{
int temp = a * b;
temp = temp / __gcd(a, b);
return temp;
}
int main()
{
cin >> x >> y;
for(int i = 1;i <= y;i++)
{
for(int j = 1;j <= y;j++)
{
if(pd[j][i] == 2)
{
ans ++;
continue;
}
if(__gcd(i,j) == x && lcm(i,j) == y)
{
ans ++;
pd[i][j] = 2;
continue;
}
pd[i][j] = 1;
}
}
cout << ans << endl;
return 0;
}
by hhy8399 @ 2024-08-23 23:58:14
c++14无法编译,c++20可以