fork download
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4.  
  5. int main(){
  6. int a, b;
  7. cin>> a >> b;
  8. if(a * 2 == b / 2){
  9. cout<< a * 2;
  10. return 0;
  11. }
  12. else if(b * 2 == a / 2){
  13. cout<< b * 2;
  14. return 0;
  15. }
  16. else if(float(int(sqrt(a * b))) == sqrt(a * b)){
  17. cout<< sqrt(a * b);
  18. return 0;
  19. }
  20. cout<< 0;
  21. return 0;
  22. }
Success #stdin #stdout 0s 4564KB
stdin
15 42
stdout
Standard output is empty