#K15611. Calculate Shipping Cost
Calculate Shipping Cost
Calculate Shipping Cost
This problem requires you to calculate the shipping cost of a box based on its dimensions. The shipping cost is equal to the surface area of the box.
You are given the length (L), width (W), height (H), and an additional cost threshold (C) for each box. The surface area of a box is calculated using the formula:
$2\times (L\times W + W\times H + H\times L)$
For each test case, compute and output the shipping cost, which is simply the surface area. Note that although a threshold C is provided, it does not affect the computation in this problem.
inputFormat
The input is given from stdin
and is formatted as follows:
- The first line contains a single integer T which denotes the number of boxes.
- Each of the next T lines contains four space-separated integers: L, W, H, and C, where L, W, and H represent the dimensions of the box, and C is a cost threshold.
outputFormat
For each test case, output the shipping cost on a new line. The shipping cost is calculated as the box's surface area using the formula:
$2\times (L\times W + W\times H + H\times L)$
All outputs should be printed to stdout
.
2
3 4 5 50
1 1 1 10
94
6
</p>