1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#include <iostream> #include<unordered_map> #include<set> #include<string> #include <vector> #include <algorithm> #include <queue> #include <cmath> #include <bitset> #include <unordered_set> #include <map> #include <numeric> using namespace std; const int MOD1 = 1e9 + 7; const int MOD2 = 998244353; using ll = long long; using ull = unsigned long long; bool cmp(int a,int b) { return a>b; } ll GCD(ll a,ll b) { return b==0?a:GCD(b,a%b); } ll LCM(ll a,ll b) { return a/(GCD(a,b)*b); } void solve() { ll a,b; cin>>a>>b; cout<<GCD(a,b)<<" "; cout<<LCM(a,b);
}
int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T=1; while(T--) { solve(); }
}
|