#C11541. Garden Flower Arrangement
Garden Flower Arrangement
Garden Flower Arrangement
You are given three positive integers n, m and f. They represent an n \times m
grid of flower beds and a total of f flowers. You want to plant exactly f flowers in the grid such that:
- Each flower bed receives at least one flower, and
- The difference between the number of flowers in any two beds is at most \(1\).
The arrangement is possible if and only if \(f \ge n\times m\) and the number of extra flowers \(f - n\times m\) satisfies
\[
(f - n\times m) \bmod (n\times m) \le 1.
\]
Determine whether it is possible to achieve such an arrangement. Print YES
if it is possible; otherwise, print NO
.
inputFormat
The input is read from stdin and consists of a single line containing three space-separated integers: n, m, and f.
outputFormat
Print a single line to stdout with either YES
if the arrangement is possible or NO
if it is not.
3 3 9
YES