#include<bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
if(N<2){
cout<<-1;
}
if(N%2==0){
int m=N/2;
int n=1;
cout<<mm-nn<<" “<<mm+nn<<endl;
}
else{
int m=N+1/2;
int n=N-1/2;
cout<<2mn<<” "<<mm+nn;
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
if(N<2){
cout<<-1;
}
if(N%2==0){
int m=N/2;
int n=1;
cout<<mm-nn<<" “<<mm+nn<<endl;
}
else{
int m=N+1/2;
int n=N-1/2;
cout<<2mn<<” "<<mm+nn;
}
return 0;
}
@rathidevesh906_1dcc73a061c159bb, refer here https://ide.codingblocks.com/s/657506
reasoning :-
If m>n>0 are integers, then (m2-n2, 2mn, m2-n2) is a Pythagorean triple. This is easily seen with a bit of algebra. Thus, plugging in various (m,n) will give various triples.
Now, our goal is to find a triple of the form (m2-n2, 2mn, m2-n2) in which our input value is one of the catheti. Note that the catheti are m2-n2 and 2mn. Also, note that the second cathetus is always even. Thus, it makes sense to consider two cases:
@rathidevesh906_1dcc73a061c159bb, u can also refer https://www.geeksforgeeks.org/generate-pythagoras-triplet-single-integer/
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.