Some test cases are not working

#include
using namespace std;
int main() {
int n;
cin>>n;

if(n>2 && n<1000000000){

if(n%2==0) {
int a=n/2;
int b=aa;
int ans1=b-1;
int ans2=b+1;
int x=ans2
ans2;
int y=nn;
int z=ans1
ans1;

if(x==(y+z)){
cout<<ans1<<" "<<ans2;
}

else{
cout<<"-1";
}

}

else {

float a=nn;
float p=a/2;
float ans1=p-.5;
float ans2=p+.5;
int x=ans2
ans2;
int y=nn;
int z=ans1
ans1;
if(x==(y+z)){
cout<<ans1<<" β€œ<<ans2;
}
else{
cout<<”-1";
}
}
}

else{
cout<<"-1";
}

return 0;

}

Hello @Abhishek4799,

Please, read the constraints carefully.
N <= 10^9
So, the product of such larger numbers will be larger than the range of int.
Solution:
Make all the data types as long long int.

Let me know if you still face any issue.
Hope, this would help.
Give a like if you are satisfied.

its still not working . I also tried to remove the decimal integers but still some cases are wrong

Here’s the code #include using namespace std; int main() { long double k; cin>>k; long long int n=k; if(k-n==0){ if(n>2 && n<1000000000){ if(n%2==0) { long long int a=n/2; long long int b=aa; long long int ans1=b-1; long long int ans2=b+1; long long int x=ans2ans2; long long int y=nn; long long int z=ans1ans1; if(x==(y+z)){ cout<<ans1<<" β€œ<<ans2; } else{ cout<<”-1"; } } else { long double a=nn; long double p=a/2; long double ans1=p-.5; long double ans2=p+.5; long long int x=ans2ans2; long long int y=nn; long long int z=ans1ans1; if(x==(y+z)){ cout<<ans1<<" β€œ<<ans2; } else{ cout<<”-1"; } } } } else{ cout<<"-1"; } return 0; }

Hello @Abhishek4799,

Share your code using Online Coding Blocks IDE.
The way you have shared it may introduce many syntax errors to it.

STEPS:

  1. Paste the code at https://ide.codingblocks.com/
  2. Save it there.
  3. Share the URL generated.

I’ll correct it for you. :slightly_smiling_face:

Sorry! for the late reply

Here the link https://ide.codingblocks.com/s/236080

Hey @Abhishek4799,

I have corrected your code:

Refer to the comments for better understanding.

Hope, this would help.

Thank you so much !