#K77202. Ball Arrangement Without Adjacent Identical Colors
Ball Arrangement Without Adjacent Identical Colors
Ball Arrangement Without Adjacent Identical Colors
You are given two non-negative integers representing the number of red balls (R) and blue balls (B). Your task is to determine whether it is possible to arrange all the balls in a row such that no two adjacent balls have the same color.
The necessary and sufficient condition for such an arrangement to exist is that the absolute difference between the number of red and blue balls does not exceed 1, i.e., $$|R - B| \le 1$$.
If the condition holds, output Possible
; otherwise, output Not Possible
.
inputFormat
The input is read from standard input (stdin
) and has the following format:
- The first line contains a single integer
T
denoting the number of test cases. - Each of the next
T
lines contains two space-separated integersR
andB
, representing the number of red and blue balls respectively.
outputFormat
For each test case, output a single line to standard output (stdout
) containing either Possible
if it is feasible to arrange the balls according to the rule, or Not Possible
otherwise.
3
3 4
1 3
10 0
Possible
Not Possible
Not Possible
</p>