fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int attempts;
  8. cin >> attempts;
  9. cout << endl;
  10.  
  11. int *a = new int[attempts];
  12. int *b = new int[attempts];
  13. int *candy = new int[attempts];
  14. bool *check = new bool[attempts];
  15.  
  16. for (int i = 0; i < attempts; i++)
  17. {
  18. cin >> a[i] >> b[i];
  19. cout << endl;
  20. }
  21.  
  22. for (int i = 0; i < attempts; i++)
  23. {
  24. candy[i] = 0;
  25.  
  26. while (check[i])
  27. {
  28. candy[i]++;
  29. if (candy[i] % a[i] == 0 && candy[i] % b[i] == 0)
  30. {
  31. cout << candy[i] << endl;
  32. check[i] = false;
  33. }
  34. }
  35. }
  36.  
  37. delete[] a;
  38. delete[] b;
  39. delete[] candy;
  40. delete[] check;
  41.  
  42. return 0;
  43. }
Success #stdin #stdout 0.01s 16064KB
stdin
Standard input is empty
stdout