fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int a, b, N, x=2;
  7.  
  8. cin >> N;
  9.  
  10. for (int j = 1; j <= N; j++)
  11. {
  12. cin >> a;
  13. cin >> b;
  14.  
  15. for (int i = 1; i <= x; i++)
  16.  
  17. {
  18.  
  19. if (x%a != 0 || x%b != 0)
  20. {
  21.  
  22. x += 2;
  23.  
  24. if (x%a == 0 && x%b == 0 && x >= a && x >= b)
  25. {
  26.  
  27. break;
  28. }
  29.  
  30. }
  31. }
  32.  
  33. cout << x << endl;
  34. x = 2;
  35. }
  36. return 0;
  37. }
Success #stdin #stdout 0s 4776KB
stdin
5
12 15
11 22
15 20
25 30
13 16
stdout
60
22
60
150
208