One thing that was not mentioned is that it is never needed to press
backspace for over (B-A)/2 times as that will always be more than B+2.

On May 1, 6:56 am, jitendra <[email protected]> wrote:
> import java.util.*;
>
> class A {
>     static Scanner scan;
>     public static double solve() {
>         int a = scan.nextInt();
>         int b = scan.nextInt();
>         double res = 2+b;
>         double p = 1;
>         for(int x=1;x<=a;x++) {
>             double f = scan.nextDouble();
>             p *= f;
>             int v = b+a+1-2*x;
>             double r2 = p*v+(1-p)*(v+b+1);
>             if(res>r2) res=r2;
>         }
>         return res;
>     }
>     public static void main(String[] args) {
>         scan = new Scanner(System.in);
>         int n = scan.nextInt();
>         for(int i=1;i<=n;i++) {
>             System.out.print("Case #"+i+": ");
>             System.out.println(solve());
>         }
>     }
>
> }
>
> i can not get
>
>         double res = 2+b;
>         double p = 1;
> and
>             int v = b+a+1-2*x;
>             double r2 = p*v+(1-p)*(v+b+1);
>             if(res>r2) res=r2;
>
> parts pls explain in detail ....... any answers and links are appreciable
> ........
>
>  A.java
> < 1KViewDownload

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to