fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3. int uoc_boi(){
  4. long long a,b;
  5. scanf("%lld %lld",&a,&b);
  6.  
  7. if(a>b){
  8. long long d=a;
  9. a=b;
  10. b=d;
  11. }
  12. long long u;
  13. u=b%a;
  14. long long h = (a / u) * b;
  15. printf("%lld %lld\n", h, u);
  16.  
  17. return 1;
  18.  
  19. }
  20.  
  21. int main(){
  22. short t;
  23. scanf("%hd",&t);
  24. while(t--){
  25. uoc_boi();
  26. }
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 5320KB
stdin
2
4 6
3 5
stdout
12 2
5 2