#include
using namespace std;
int main(){
int N;
cin>>N;
int X;
X=N+1;
int Y;
Y=N+2;
while(N>0){
if(N*N+X*X==Y*Y){
cout<<X <<" "<<Y<<endl;
break;
}
else{
cout<<" -1 "<<endl;
break;
}
}
return 0;
}
#include
using namespace std;
int main(){
int N;
cin>>N;
int X;
X=N+1;
int Y;
Y=N+2;
while(N>0){
if(N*N+X*X==Y*Y){
cout<<X <<" "<<Y<<endl;
break;
}
else{
cout<<" -1 "<<endl;
break;
}
}
return 0;
}
@shresth_2000 you have to do this question in o(1) time as constraints are large
also your logic seems wrong
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.