#C8778. Max Flowers in Garden
Max Flowers in Garden
Max Flowers in Garden
You are given a garden represented by an n × m grid. Each cell of the grid can either have a flower or be empty. In order to maintain a beautiful garden, no two flowers can be planted in adjacent cells (cells that share a side).
Your task is to compute the maximum number of flowers that can be planted in the garden under this condition.
The optimal strategy is to plant flowers in a checkerboard pattern. Mathematically, the answer is given by the formula:
$$\lceil \frac{n\times m}{2} \rceil$$
For example, in a 3×3 garden, the maximum number of flowers is 5.
inputFormat
The input consists of a single line containing two space-separated integers n and m representing the number of rows and columns of the garden, respectively.
outputFormat
Output a single integer, which is the maximum number of flowers that can be planted in the garden, such that no two are adjacent.## sample
3 3
5