Problem B
Calories From Fat
![/problems/calories/file/statement/en/img-0001.png](/problems/calories/file/statement/en/img-0001.png)
Others recommend radically different amounts of fat. Dean Ornish, for example, suggests that less than 10% of total caloric intake should be fat. On the other hand, Robert Atkins recommends the elimination of all carbohydrate with no restriction on fat. It has been estimated that the average Atkins dieter consumes 61% of Calories from fat.
From a record of food eaten in one day, you are to compute the percent Calories from fat. The record consists of one line of input per food item, giving the quantity of fat, protein, sugar, starch and alcohol in each. Each quantity is an integer followed by a unit, which will be one of: g (grams), C (Calories), or % (percent Calories). Percentages will be between 0 and 99. At least one of the ingredients will be given as a non-zero quantity of grams or Calories (not percent Calories).
Input
Input will consist of several test cases (at most 150). Each test case will have one or more lines as described above (at most 100). Each test case will be terminated by a line containing ’-’. An additional line containing ’-’ will follow the last test case.
Output
For each test case, print percent Calories from fat, rounded to the nearest integer.
Sample Input 1 | Sample Output 1 |
---|---|
3g 10g 10% 0g 0g 55% 100C 0% 0g 30g - 25g 0g 0g 0g 0g - 1g 15% 20% 30% 1C - - |
53% 100% 32% |