[Solution] Break the Stick CodeChef Solution | CodeChef Problem Solution 2022
Chef has a stick of length .
He can break the stick into or more parts such that the parity of length of each part is same. For example, a stick of length can be broken into three sticks of lengths since each part is odd, but it cannot be broken into two sticks of lengths since one is even and the other is odd.
Chef can then continue applying this operation on the smaller sticks he obtains, as many times as he likes.
Can Chef obtain a stick of length exactly by doing this?
Input Format
- The first line of input will contain a single integer , denoting the number of test cases. The description of the test cases follows.
- Each test case consists of a single line of input, containing two space-separated integers .
Output Format
For each test case, output on a new line YES
if Chef can obtain a stick of length exactly , and NO
otherwise.
Each letter of the output may be printed in either lowercase or uppercase. For example, the strings YES
, yEs
, and Yes
will be considered identical.
No comments:
Post a Comment