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

建议使用的浏览器:

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

2979:Expensive Drink

题目描述
There are some water, milk and wine in your kitchen. Your naughty little sister made some strange drinks by mixing them together, and then adds some sugar! She wants to know whether they taste good, but she doesn't want to try them herself. She needs your help.

Your sister knows that you don't want to drink them either (anyone wants to?), so she gives you a chance to escape: if you can guess the price of a special drink, she gives you freedom. Warning: she loves her special drink so much that you should never under-estimate its cost! That is, you're to find the most expensive possible price of it.

The price of each drink equals to its cost. If the amounts of water, milk, wine and sugar used in the drink are a1, a2, a3 and a4 respectively, and the unit costs of water, milk, wine and sugar are c1, c2, c3 and c4 respectively, then the drink costs a1c1 + a2c2 + a3c3 + a4c4 . To give you some hope to win, she told you the costs of exactly n ordinary drinks. Furthermore, she promised that the total cost of sugar a4c4 is always a real number in the interval [L, R] , in any drink.

Sadly, you don't know the exact price of anything (you're a programmer, not a housewife!), but you know that water is the cheapest; wine is the most expensive, i.e., 0<=c1<=c2<=c3 . Then the best thing you can do is to assume units costs can be any real numbers satisfying this inequality.

Write a program to find the highest possible price of the special drink.
输入解释
The input contains several test cases. The first line of each test case contains three positive integers n, L, R (1<=n<=100, 0<=L<=R<=100) . The next n lines each contain four non-negative integer a1, a2, a3 , p (0<=a1,a2,a3<=100, 0<=p<=10000) , the amount of water, milk and wine, and the price. The last line of the case contains three integers a1, a2, a3 (0<=a1,a2,a3<=100) , the drink to be estimated. The last test case is followed by a single zero, which should not be processed.
输出解释
For each test case, print the case number and the highest possible price to four decimal places. If the input is selfcontradictory, output ``Inconsistent data". If the price can be arbitrarily large, output ``Too expensive!".
输入样例
1 3 5 
1 2 3 10
2 4 6 
1 2 4 
1 1 1 1
1 1 1 
1 3 8 
0 1 0 17
0 0 1 
3 1 2 
2 1 3 14
1 5 1 15
7 3 2 21
4 1 6 
2 0 2 
45 31 53 4087
30 16 1 1251
11 51 34
0
输出样例
Case 1: 19.0000 
Case 2: Inconsistent data 
Case 3: Too expensive! 
Case 4: 26.2338 
Case 5: 3440.3088
来自杭电HDUOJ的附加信息
Recommend gaojie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-2979

最后修改于 2020-10-25T22:58:52+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 65536/65536K(Java/Others)