题解 | 小乐乐与欧几里得
小乐乐与欧几里得
https://www.nowcoder.com/practice/da13e0cf321e4df9acd0fdf0a433cbb0
#include <stdio.h> #if 1 int main() { long long a = 0; long long b = 0; long long max = 0; scanf("%lld %lld", &a, &b); long long min = a * b; //求最大公约数 while (b) { max = a % b; a = b; b = max; } //求最小公倍数 max = a; min /= max; printf("%lld\n", min + max); } #endif