3.2. 박인서 ¶
#include <iostream> int gcd(int a, int b) { while (a%b != 0) { int t = a%b; a = b; b = t; } return b; } int main() { int a, b; std::cin >> a >> b; int c = b / a, r = 1; for (int i = 1; i*i <= c; i++) if (i*(c / i) == c && gcd(i,c/i)==1) r = i; std::cout << a*r << ' ' << a*c / r; return 0; }