here is my code i am having 2 out of 5 wrong answer which i am not able to comprehend.
here is my code
import java.util.*;
public class Main {
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int n=in.nextInt();
double a=0;
double b=0;
double check=0;
if(n==0||n==1)
{
System.out.println("-1");
return;
}
if(n%2==0)
{
a=(n*n/4-1);
b=(n*n/4+1);
}
else
{
int store = 1 * n * n + 1;
a=store / 2 - 1;
b=store / 2 ;
}
check=b-(int)b;
if(check==0&&isTri(a,b,n))
System.out.println((int)a+" "+(int)b);
else
System.out.println("-1");
}
static int max(double a,double b,int c)
{
int g,f,h;
f=(int)a;
g=(int)b;
h=c;
if(f>g&&f>h)
return f;
else if(g>f&&g>h)
return g;
else
return h;
}
static boolean isTri(double a,double b,int c)
{
if (a + b <= c || a + c <= b || b + c <= a)
return (false);
else return true;
}
}