|
|
вернуться в форумПоказать все сообщения Спрятать все сообщения1 Wrong Fadeev.E.V 2 янв 2012 04:43 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 Hi, Can you please tell me how did you find this formula ? I have tried many times, but cannot find the solution. Thanks. 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 |
|
|