[Solution] Weights CodeChef Solution 2022 | Solution CodeChef
Problem
Chef is playing with weights. He has an object weighing units. He also has three weights each of and units respectively. Help him determine whether he can measure the exact weight of the object with one or more of these weights.
If it is possible to measure the weight of object with one or more of these weights, print YES
, otherwise print NO
.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of single line containing a four positive integers and .
Output Format
For each test case, output on a new line YES
if it is possible to measure the weight of object with one or more of these weights, otherwise print NO
.
You may print each character of the string in either uppercase or lowercase (for example, the strings yes
, YES
, Yes
, and yeS
will all be treated as identical).
Explanation:
Test Case : It is not possible to measure units using any combination of given weights.
Test Case : Chef can use the second weight of units to measure the object exactly.
Test Case : Chef can use combination of first and third weights to measure units.
Test Case : Chef cannot measure units of weight using any combination of given weights.
No comments:
Post a Comment