最小公倍数LCM

输入2个正整数A,B,求A与B的最小公倍数。
Input
2个数A,B,中间用空格隔开。(1<= A,B <= 10^9)
Output
输出A与B的最小公倍数。
Input示例
30 105
Output示例
210
李陶冶 (题目提供者)
 
C++的运行时限为:1000 ms ,空间限制为:131072 KB
代码实现:
 1 #include<iostream>
 2 #define LL long long
 3 using namespace std;
 4 LL a,b;
 5 inline LL gcd(int x,int y){return x%y==0?y:gcd(y,x%y);}
 6 int main(){
 7     cin>>a>>b;
 8     cout<<a*b/gcd(a,b)<<endl;
 9     return 0;
10 }

题目来源:51Nod

原文地址:https://www.cnblogs.com/J-william/p/6372358.html