by **arabin** » Sat Sep 03, 2016 10:44 pm

In tonights contest i have submitted the code given below for the problem number 1. but it was a wrong answer i dont know why? can anyone help me to solve this. i dont understand where is the problem.

- Code: Select all
`class MyClass {`

/**

* @param args the command line arguments

*/

public static void main(String[] args) throws java.lang.Exception{

// TODO code application logic here

Scanner kbScanner = new Scanner(System.in);

int test = kbScanner.nextInt();

if (test>=1&&test<=1000) {

double []answer = new double[test];

for (int i = 0; i < test; i++) {

answer[i] = calculate(kbScanner.nextInt(),kbScanner.nextInt());

}

for (int i = 0; i < answer.length; i++) {

System.out.println("Case "+(i+1)+":"+" "+(int)answer[i]);

}

}

}

private static double calculate(int next, int next0) {

return Math.pow((2*next),2)-Math.pow(next0,2);

}

}