| <p> | |
| Alex's New Year's resolution for 2015 is to eat healthier foods. He's done some | |
| research and has found out that calories come from three main sources, called | |
| macronutrients: protein, carbohydrates, and fat. Alex wants to get the right | |
| balance of protein, carbohydrates, and fat to have a balanced diet. | |
| For each available food, Alex can only choose to eat it or not eat it. He | |
| can't eat a certain food more than once, and he can't eat a fractional amount | |
| of a food. | |
| </p> | |
| <h3>Input</h3> | |
| <p> | |
| Input begins with an integer <strong>T</strong>, the number of test cases. | |
| For each test case, the first line consists of three space-separated | |
| integers: <strong>G<sub>P</sub></strong>, | |
| <strong>G<sub>C</sub></strong>, and <strong>G<sub>F</sub></strong>, | |
| which represent the amount of | |
| protein, carbohydrates, and fat that Alex wants to eat. The next line has the number of foods for that test case, an integer <strong>N</strong>. | |
| The next <strong>N</strong> lines each consist of three space-separated integers: | |
| <strong>P</strong>, <strong>C</strong>, and <strong>F</strong>, | |
| which represent the amount of protein, carbohydrates, and fat in that food, respectively. | |
| </p> | |
| <h3>Output</h3> | |
| <p> | |
| For each test case <em>i</em>, print a line containing "Case #<em>i</em>: " followed by | |
| either "yes" if it is possible for Alex to eat the exact amount of each | |
| macronutrient, or "no" if it is not possible. | |
| </p> | |
| <h3>Constraints</h3> | |
| <p> | |
| 1 ≤ <strong>T</strong> ≤ 20 <br/> | |
| 1 ≤ <strong>N</strong> ≤ 20 <br/> | |
| 10 ≤ <strong>G<sub>P</sub></strong>, <strong>G<sub>C</sub></strong>, | |
| <strong>G<sub>F</sub></strong> ≤ 1000 <br/> | |
| 10 ≤ <strong>P</strong>, <strong>C</strong>, <strong>F</strong> ≤ 1000 <br/> | |
| </p> | |