ll gcd(ll x, ll y) {
while (y) {
ll tmp = y;
y = x % y;
x = tmp;
}
return x;
}
ll lcm(ll x, ll y) {
return x * y / gcd(x, y);
}
----分母除以最大公约数即为最简
y = y / gcd(x, y);
2024-03-24 21:40:46
ll gcd(ll x, ll y) {
while (y) {
ll tmp = y;
y = x % y;
x = tmp;
}
return x;
}
ll lcm(ll x, ll y) {
return x * y / gcd(x, y);
}
----分母除以最大公约数即为最简
y = y / gcd(x, y);