1 #include<iostream> 2 using namespace std ; 3 int gcd(int a,int b) 4 { 5 if(a%b!=0) 6 return gcd(b,a%b); 7 else 8 return b ; 9 } 10 int main() { 11 int a , b ; 12 while(cin >> a >> b) { 13 int c = gcd(a,b) ; 14 cout << c << " " << a*b/c << endl ; 15 } 16 return 0 ; 17 }
时间: 2024-10-18 07:41:07