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.
|
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
//最大公约数
|
|
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() {
|
|
cout << gcd(4, 6) << endl;
|
|
cout << lcm(4, 6) << endl;
|
|
return 0;
|
|
} |