Statistics

Problem Statement for "MinimalTriangle"

Problem Statement

You are given a int length. We have a regular hexagon: a polygon with six sides, in which all internal angles have 120 degrees and length is the length of each side. We are going to draw three non-intersecting diagonals in some way. These will divide the hexagon into four triangles. We will then compute their areas, take a piece of paper and write down the smallest of those four areas. Compute and return the largest number we can obtain on our piece of paper (by choosing which diagonals to draw).

Definition

Class:
MinimalTriangle
Method:
maximalArea
Parameters:
int
Returns:
double
Method signature:
double maximalArea(int length)
(be sure your method is public)

Notes

  • Your return value must have a relative or an absolute error of less than 1e-9.

Constraints

  • length will be between 1 and 1,000,000 (10^6), inclusive.

Examples

  1. 5

    Returns: 10.825317547305485

  2. 10

    Returns: 43.30127018922194

  3. 100000

    Returns: 4.330127018922194E9

  4. 100

    Returns: 4330.127018922194

  5. 1000

    Returns: 433012.70189221937

  6. 1

    Returns: 0.43301270189221935

  7. 2

    Returns: 1.7320508075688774

  8. 3

    Returns: 3.897114317029974

  9. 1000000

    Returns: 4.3301270189221936E11

  10. 999999

    Returns: 4.330118358672486E11

  11. 3242

    Returns: 4551207.716051092

  12. 1233

    Returns: 658304.4475470202

  13. 8768

    Returns: 3.3289074285834506E7

  14. 3457

    Returns: 5174869.415395928

  15. 234234

    Returns: 2.3757487301863487E10

  16. 34555

    Returns: 5.1703796149431825E8

  17. 741

    Returns: 237759.04736768172

  18. 98283

    Returns: 4.182707017075714E9

  19. 97708

    Returns: 4.133908726413193E9

  20. 772

    Returns: 258068.64212453246

  21. 97431

    Returns: 4.1105028730324244E9

  22. 92415

    Returns: 3.6981589343448176E9

  23. 987

    Returns: 421827.55078964145

  24. 98228

    Returns: 4.1780269703273296E9

  25. 96988

    Returns: 4.073208520887716E9

  26. 890

    Returns: 342989.361168827

  27. 92714

    Returns: 3.7221277336829104E9

  28. 96949

    Returns: 4.0699334106974077E9

  29. 884

    Returns: 338380.37396988616

  30. 99111

    Returns: 4.253479579557329E9

  31. 94672

    Returns: 3.8810008682338767E9

  32. 741

    Returns: 237759.04736768172

  33. 98835

    Returns: 4.2298227550456324E9

  34. 90385

    Returns: 3.5374748488758454E9

  35. 729

    Returns: 230120.70330630295

  36. 4

    Returns: 6.92820323027551


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: