#K91692. Planting Trees in a Rectangular Garden
Planting Trees in a Rectangular Garden
Planting Trees in a Rectangular Garden
You are given the dimensions of a rectangular land and the radius of the tree (each tree is approximated as a circle with radius \(r\)). The task is to determine the maximum number of non-overlapping trees that can be planted on the land. Trees are arranged in a grid layout such that each tree occupies a space of width \(2r\) and height \(2r\).
More formally, if the width of the land is \(w\) and the height is \(h\), the maximum number of trees is given by:
[ \text{max_trees} = \left\lfloor \frac{w}{2r} \right\rfloor \times \left\lfloor \frac{h}{2r} \right\rfloor ]
where \(\lfloor x \rfloor\) denotes the floor function.
The input is provided via standard input (stdin) and the output should be printed to standard output (stdout).
inputFormat
The input consists of a single line containing three space-separated integers:
- w: the width of the rectangular land.
- h: the height of the rectangular land.
- r: the radius of each tree.
Example: 10 10 1
outputFormat
Output a single integer which is the maximum number of trees that can be planted without overlapping, according to the grid-based arrangement.
Example Output: 25
10 10 1
25
</p>