fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int test,a,b;
  6. int x=0,y=0;
  7.  
  8. int main()
  9. {
  10. cin>>test;
  11.  
  12. for(int i=1; i=test; i++)
  13. {
  14. cin>>a>>b;
  15. x=a;
  16. y=b;
  17. while (x!=y)
  18. {
  19. if(x<y) x=x+a;
  20. else if(x>y) y=y+b;
  21. }
  22. cout<<x;
  23.  
  24. }
  25. }
  26.  
Success #stdin #stdout 0.01s 5396KB
stdin
Standard input is empty
stdout
Standard output is empty