求多个数的最小公倍数
重点一:
两个数的乘积=最小公倍数*最大公约数;
求多个数的最小公倍数,即不断求两个数的最小公倍数。
重点二:
求两个数的最大公约数
int gcd(long long x, long long y)
{
int a;
if(x<y)a=x, x=y, y=a;
while(y != 0)
{
a = x%y;
x = y;
y = a;
}
return x;
}
重点一:
两个数的乘积=最小公倍数*最大公约数;
求多个数的最小公倍数,即不断求两个数的最小公倍数。
重点二:
求两个数的最大公约数
int gcd(long long x, long long y)
{
int a;
if(x<y)a=x, x=y, y=a;
while(y != 0)
{
a = x%y;
x = y;
y = a;
}
return x;
}