Trying to solve this, it only passes 3 test cases. Cound not figure out what is wrong with it. Help would be much appreciated.
Stuck at 3 test cases: Pythagoras Triplet problem
i think you make this complex
there is a simple formual for that
you can use it
use these simple conditions
if(x<3)cout<<"-1";
else if(x%2==0){
cout<<((x*x)/4)-1<<" ";
cout<<((x*x)/4)+1<<endl;
}
else{
cout<<(x*x-1)/2<<" ";
cout<<(x*x+1)/2<<endl;
}
Complete Code
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.