GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Sunday 5 June 2022

[Solution] Break the Stick CodeChef Solution | CodeChef Problem Solution 2022

Chef has a stick of length N.

He can break the stick into 2 or more parts such that the parity of length of each part is same. For example, a stick of length 11 can be broken into three sticks of lengths {3,3,5} since each part is odd, but it cannot be broken into two sticks of lengths {5,6} 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.

Solution Click Below:-  CLICK HERE


Can Chef obtain a stick of length exactly X by doing this?

Input Format

  • The first line of input will contain a single integer T, 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 N,X.

Output Format

For each test case, output on a new line YES if Chef can obtain a stick of length exactly X, and NO otherwise.

Each letter of the output may be printed in either lowercase or uppercase. For example, the strings YESyEs, and Yes will be considered identical.

Constraints

  • 1T1000

No comments:

Post a Comment