#include<iostream> #include<vector> #include<string> #include <algorithm> #include <math.h> using namespace std; int maxyue(int a, int b) { int c = a % b; while(c != 0){ a = b; b = c; c = a % b; } return b; } int main() { int a,b; scanf("%d %d",&a,&b); int yue = maxyue(a,b); int bei = a * b / yue; cout <<bei<<" " << yue; return 0; } |
Double click to view unformatted code.