题目链接 Luogu P4057
\[x * y = \gcd(x, y) \times lcm(x, y)\]
\[lcm(x, y) = \frac{x \times y}{\gcd(x, y)}\]
\[lcm(x, y) = \frac{x}{\gcd(x, y)} \times y\]
\(Code:\)
#include <iostream>
#include <cstdio>
#define ull unsigned long long
using namespace std;
ull x, y, z;
inline ull gcd(ull x, ull y) {
return ! y ? x : gcd(y, x % y);
}
int main() {
scanf("%lld %lld %lld", &x, &y, &z);
x = x / gcd(x, y) * y;
z = z / gcd(z, x) * x;
printf("%lld\n", z);
return 0;
}
\(update~~2019.9.22\) 修改了码风,用Latex写公式