1 Wrong

Please tell me why I wrong?

import java.util.*;

import java.math.*;

public class Program {

public static void main (String arqs[]) {

Scanner sc = new Scanner(System.in);

int a = sc.nextInt(),b = sc.nextInt();

double x = (a+Math.sqrt(a*a+2*b*b))/2;

double S = (a+x)/2*Math.sqrt(b*b-(x-a)*(x-a));

System.out.printf("%.9f",S);

}

}

*Edited by author 02.01.2012 04:44*

Re: 1 Wrong

Hi,

Can you please tell me how did you find this formula ?

I have tried many times, but cannot find the solution.

Thanks.

Re: 1 Wrong

Oh, all is very easy. Using derivative, you can find angle between sticks in which area has a maximum value. Just find stationary point of area function.

*Edited by author 12.02.2012 17:45*

Re: 1 Wrong

Posted by

watashi 22 Feb 2012 17:53

Thank you very much.