## GUPTA MECHANICAL

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

# [Solution] Weights CodeChef Solution 2022 | Solution CodeChef

## Problem

Chef is playing with weights. He has an object weighing $W$ units. He also has three weights each of $X, Y,$ and $Z$ 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 $T$, denoting the number of test cases.
• Each test case consists of single line containing a four positive integers $W, X, Y,$ and $Z$.

### 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.

Solution Click Below:-  👉
👇👇👇👇👇

You may print each character of the string in either uppercase or lowercase (for example, the strings yesYESYes, and yeS will all be treated as identical).

### Explanation:

Test Case $1$: It is not possible to measure $5$ units using any combination of given weights.

Test Case $2$: Chef can use the second weight of $7$ units to measure the object exactly.

Test Case $3$: Chef can use combination of first and third weights to measure $8+12=20$ units.

Test Case $4$: Chef cannot measure $20$ units of weight using any combination of given weights.