ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1874. Football Goal

1 Wrong
Posted by Fadeev.E.V 2 Jan 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
Re: 1 Wrong
Posted by watashi 9 Jan 2012 01:37
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
Posted by _-Re@l-_ 12 Feb 2012 17:39
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.