PickupBed
TCCC06 Round 1A · 2006-08-22 · by dgoodman
Problem Statement
| |
| |
| x x x x |
| x x |
| x x |
| x x x x x |
| x x x x |
| x x x |
| x x x x |
| x x x x x|
| x x x x x x|
| x x x x x x x x x |
|-------------------------------------
<--- length of truck --->
Create a class PickupBed that contains a method length that is given a
Notes
- A return value with either an absolute or relative error of less than 1.0E-9 is considered correct.
Constraints
- ht contains between 1 and 8 elements, inclusive.
- Each element of ht is between 1 and 1000, inclusive.
{5,5,5}
Returns: 15.0
The pipes will lie with their perpendicular sides against each other. Each one will require the full 5 units of the truck's length.
{17}
Returns: 17.0
{10,1,1}
Returns: 10.0
We can put the big one between the 2 little ones. The little ones can fit entirely in the area under the slanted sides of the big one.
{10,2,2}
Returns: 10.97056274847714
{1,2,3,4,5,6,7,8}
Returns: 33.21320343559643
Submissions are judged against all 74 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class PickupBed with a public method double length(vector<int> ht) · 74 test cases · 2 s / 256 MB per case