fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int test, x, y;
  7. cin >> test;
  8.  
  9. for (int i = 0; i < test; ++i)
  10. {
  11. cin >> x >> y;
  12. int iloczyn = x * y;
  13.  
  14. do
  15. {
  16. if (x > y)
  17. {
  18. x -= y;
  19. }
  20. else
  21. {
  22. y -= x;
  23. }
  24. }
  25. while (x != y);
  26.  
  27. cout << iloczyn / x << endl;
  28. }
  29. system("PAUSE");
  30. }
Time limit exceeded #stdin #stdout 5s 15232KB
stdin
Standard input is empty
stdout
-1347048768