当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1929:Calories from Fat

题目描述
Fat contains about 9 Calories/g of food energy. Protein, sugar, and starch contain about 4 Calories/g, while alcohol contains about 7 Calories/g. Although many people consume more than 50% of their total Calories as fat, most dieticians recommend that this proportion should be 30% or less. For example, in the Nutrition Facts label to the right, we see that 3g of fat is 5% of the recommended daily intake based on a 2,000 calorie diet. A quick calculation reveals that the recommended daily intake of fat is therefore 60g; that is, 540 Calories or 27% Calories from fat.
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 will consist of several test cases. Each test case will have one or more lines as described above. Each test case will be terminated by a line containing '-'. An additional line containing '-' will follow the last test case.
输出解释
For each test case, print percent Calories from fat, rounded to the nearest integer.
输入样例
3g 10g 10% 0g 0g
55% 100C 0% 0g 30g
-
25g 0g 0g 0g 0g
-
1g 15% 20% 30% 1C
-
-
输出样例
53%
100%
32%

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-1929

最后修改于 2020-10-29T06:18:14+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 30000