fork(2) download
  1. #include <iostream>
  2.  
  3. int a, b, N;
  4. using namespace std;
  5. int main()
  6. {
  7. cin>>N;
  8.  
  9. if (N>=1&&N<=30)
  10. for (int i=0;i<N;i++)
  11. {
  12. cin>>a>>b;
  13. if ((a<=30)&&(b<=30)&&(a>=10)&&(b>=10)){
  14.  
  15. if (a==b) cout<< b<<endl;
  16. else if (a%10==0&&b%10==0) cout<<((a/10)*(b/10)*10)<<endl;
  17. else if (a>b){
  18. for(int j=a;j>0; j--)
  19. if (a%j==0&&b%j==0) b=b/j;
  20. cout<<a*b<<endl;
  21. }
  22. else if(a<b) {for(int j=b;j>0; j--)
  23. if (a%j==0&&b%j==0) a=a/j;
  24. cout<<a*b<<endl;
  25. }
  26. }
  27. }
  28.  
  29.  
  30. return 0;
  31. }
  32.  
  33.  
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty