You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
328 B
18 lines
328 B
2 years ago
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
//最大公约数:辗转相除法
|
||
|
int gcd(int x, int y) {
|
||
|
if (y == 0) return x;
|
||
|
return gcd(y, x % y);
|
||
|
}
|
||
|
|
||
|
//最小公倍数=两数乘积/最大公约数
|
||
|
int main() {
|
||
|
int x, y;
|
||
|
cin >> x >> y;
|
||
|
cout << (x * y) / gcd(x, y) << endl;
|
||
|
return 0;
|
||
|
}
|