I am facing the same issue again. while providing the test case as custom input code is working fine. but after submitting the code test case is not passing… ?
ip : 99999979
op : 4999997900000220 4999997900000221
my code:
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
long num = sc.nextLong();
if(num<=2) System.out.println("-1");
else{
if(num%2==0){
long var = (long) Math.pow(num,2)/4;
System.out.println((var-1)+" "+(var+1));
}else{
long n1 = (long)(Math.pow(num,2)-1)/2;
long n2 = (long)(Math.pow(num,2)+1)/2;
System.out.println(n1+" "+n2);
}
}
}
}
//had the same issue for “basic calculator” problem