#K77512. Red and Blue Stones Arrangement
Red and Blue Stones Arrangement
Red and Blue Stones Arrangement
You are given a sequence of stones of total length (y). Among these stones, (r) are red and (b) are blue. The task is to determine if it is possible to arrange these stones in a sequence such that no two red stones are adjacent.
To ensure that no two red stones are consecutive, there must be at least one blue stone between every pair of red stones. Mathematically, this can be expressed as:
(r - 1 \le b)
and since all stones must be used, we also have:
(r + b = y).
Output "YES" if the arrangement is possible, otherwise output "NO".
inputFormat
The input is read from standard input (stdin).
The first line contains a single integer (T) denoting the number of test cases. Each of the following (T) lines contains three space-separated integers: (y) (the total number of stones), (r) (the number of red stones), and (b) (the number of blue stones).
outputFormat
For each test case, output a single line to standard output (stdout) containing "YES" if it is possible to arrange the stones such that no two red stones are adjacent, and "NO" otherwise.## sample
3
5 2 3
4 3 1
6 2 4
YES
NO
YES
</p>