题解 | #小乐乐与欧几里得#
小乐乐与欧几里得
https://www.nowcoder.com/practice/da13e0cf321e4df9acd0fdf0a433cbb0
#include <stdio.h> //辗转相除法 int main() { long long m, n; while (scanf("%lld %lld", &m, &n) != EOF) { // 注意 while 处理多个 case // 64 位输出请用 printf("%lld") to long long max,min; long long a = m; long long b = n; long long c = 0; while(c = a % b) { a = b; b = c; } max = b; min = m * n / max; printf("%lld\n",min + max); } return 0; }