#K4011. Minimum Tiles Required
Minimum Tiles Required
Minimum Tiles Required
You are given a rectangular garden of dimensions \(n \times m\) and a tile of dimensions \(a \times b\). Tiles may be rotated by 90°; that is, a tile of dimensions \(a \times b\) can also be used in a \(b \times a\) orientation. Your task is to determine the minimum number of tiles required to completely cover the garden without any gaps.
The number of tiles needed when placing the tile in one orientation can be computed using the ceiling function as follows:
\(tiles_{normal} = \lceil \frac{n}{a} \rceil \times \lceil \frac{m}{b} \rceil\)
Similarly, if the tile is rotated, the number of tiles required is:
\(tiles_{rotated} = \lceil \frac{n}{b} \rceil \times \lceil \frac{m}{a} \rceil\)
Your final answer is the minimum of these two values.
inputFormat
The input consists of a single line containing four space-separated integers \(n\), \(m\), \(a\), and \(b\):
- \(n\) and \(m\): dimensions of the garden.
- \(a\) and \(b\): dimensions of the tile.
outputFormat
Output a single integer: the minimum number of tiles required to cover the garden.
## sample6 6 4 3
4