//求最大公因数
int gcd(int x, int y)
{
int MAX = max(x, y);
int MIN = min(x, y);
return MAX % MIN == 0? MIN : gcd(MIN, MAX % MIN);
}
int lcm(int x, int y)
{
return x * y / gcd(x, y);
}
//求最大公因数
int gcd(int x, int y)
{
int MAX = max(x, y);
int MIN = min(x, y);
return MAX % MIN == 0? MIN : gcd(MIN, MAX % MIN);
}
int lcm(int x, int y)
{
return x * y / gcd(x, y);
}
转载于:https://www.cnblogs.com/lMonster81/p/10433902.html