fork download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. using namespace std;
  5.  
  6. int main(void)
  7. {
  8. int t;
  9. cin >> t;
  10.  
  11. while (t--)
  12. {
  13. int n1, n2, low = 1;
  14. cin >> n1 >> n2;
  15.  
  16. for (int i = 2; i <= min(n1, n2); i++)
  17. {
  18. if (n1 % i == 0 && n2 % i == 0)
  19. low = i;
  20. }
  21. cout << n2 / low * n1 << endl;
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0s 4996KB
stdin
3
1 45000
6 10
13 17
stdout
45000
30
221