代码:
#include<stdio.h> #include<algorithm> using namespace std; int gcd(int x, int y) { while(x^=y^=x^=y%=x); return y; } int f(int x, int y) { return x * y / gcd(x, y); } int main() { int x,y; while(scanf("%d %d",&x,&y)!=EOF) { printf("%d %d\n",gcd(x,y),f(x,y)); } return 0; }