题解 | #求最小公倍数#
求最小公倍数
https://www.nowcoder.com/practice/22948c2cad484e0291350abad86136c3
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int a, b;
while (cin >> a >> b) { // 注意 while 处理多个 case
int max_num=max(a,b);
while(true)
{
if(max_num%a==0&&max_num%b==0)
{
break;
}
max_num++;
}
cout<<max_num;
}
}
// 64 位输出请用 printf("%lld")
曼迪匹艾公司福利 141人发布