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

建议使用的浏览器:

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

2810:Take Your Vitamins

题目描述
Write a program to help prepare these nutritional labels by computing that percentage from the information on the amount present in one serving and the amount constituting the minimum daily requirement.
输入解释
Input consists of one or more lines, each of the form:

A U R V

where A is the amount of a vitamin/mineral present in one serving of the food product, U is the units in which A is measured, R is the minimum daily requirement for that vitamin/mineral, measured in the same units as A , and V is the name of that vitamin/mineral. A and R will be floating point numbers. U will be a string of alphabetic characters with no embedded spaces. V will be a string of characters, possibly including spaces. A , U , R , and V will be separated from one another by exactly one space, and V is terminated by the end of the input line. End of the input is signaled by a line in which A is negative.
输出解释
For each line of input data, your program should determine the percentage of the recommended daily requirement being provided for that vitamin/mineral. If it is at least 1% , your program should print a line of the form

V A U P %

where V , A , and U are the quantities from the input, and P is the percentage of the minimum daily requirement represented by the amount A .

V should be printed left-justified on the line. A should be printed with 1 digit precision, and P with zero digits precision. V , A , U , and P should be separated by one space each.

After the last such line, your program should print a line stating

Provides no significant amount of:

followed by a list of the names of all vitamins/minerals which are provided as less than 1% of the minimum daily requirement. These should be printed one name per line, in the order they occurred within the input.
输入样例
3500.0 iu 5000.0 Vitamin A 
60.0 mg 60.0 Vitamin C 
0.15 g 25.0 Fiber 
109. mg 990. Phosphorus 
0.0 mg 1000.0 Calcium 
25.0 mg 20.0 Niacin 
-1.0 x 0.0 x
输出样例
Vitamin A 3500.0 iu 70% 
Vitamin C 60.0 mg 100% 
Phosphorus 109.0 mg 11% 
Niacin 25.0 mg 125% 
Provides no significant amount of: 
Fiber 
Calcium

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

题目来源 Mid-Atlantic 2005

源链接: POJ-2810

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

共提交 0

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