TopcoderArchive
Archive
Algorithm problem

MinimizeExpression

Problem statement, definition, constraints, and public examples.

Problem Statement

Find the minimum value of the expression.

Definition

Class:
MinimizeExpression
Method:
findMinimum
Parameters:
int, int, int, int, int, int, int, int, int, long
Returns:
double
Method signature:
double findMinimum(int n1, int m1, int n2, int m2, int n3, int m3, int a, int b, int c, long s)
(be sure your method is public)

Notes

  • Any return within 1e-6 absolute or relative error is considered correct.

Constraints

  • 1 ≤ n1,m1,n2,m2,n3,m3,a,b,c ≤ 100
  • 1 ≤ s ≤ 1018.

Examples

  1. 1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    Returns: 2.999999999999999
    The expression here is : xy + yz + zx , given xyz = 1. The expression achieves minimum value at x=y=z=1 which is 3.
  2. 8
    37
    42
    33
    19
    85
    29
    98
    58
    87674775698767950
    Returns: 4749637.019215662
    The minimum value in this case is 4749637.0192156653 .
Back to all problems