#K71117. Minimum Rolls for Fence Construction
Minimum Rolls for Fence Construction
Minimum Rolls for Fence Construction
You are given several rectangular fields. The task is to determine the minimum number of rolls needed to cover the entire perimeter of each field. For each test case, you are given three integers: the length L, the width W of the field, and the length of a single roll of material R.
The perimeter of a rectangle is given by the formula:
\(P = 2\times (L+W)\)
Since partial rolls cannot be used, the number of rolls needed is the ceiling of the ratio \(\frac{P}{R}\), i.e.,
\(\text{rolls} = \lceil \frac{2(L+W)}{R} \rceil\).
Read the input, process each test case, and output the required rolls for fencing each field on a new line.
inputFormat
The first line of input contains an integer T (the number of test cases). Each of the following T lines contains three space-separated integers: L (length of the field), W (width of the field), and R (length of one roll).
outputFormat
For each test case, output the minimum number of rolls required, each on a separate line.
## sample1
20 30 15
7
</p>