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.

21 lines
358 B

#include <bits/stdc++.h>
using namespace std;
int a, b;
//最大公约数,辗转相除法
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
//最小公倍数
int lcm(int a, int b) {
return a * b / gcd(a, b);
}
int main() {
cin >> a >> b;
printf("%d,%d", gcd(a, b), lcm(a, b));
return 0;
}