No.453 Pharmaceutical Company
タグ : / 解いたユーザー数 132
作問者 :
nmnmnmnmnmnmnm
Problem Statement
A pharmaceutical company in the Country of Yukicoda makes Product A and Product B.
・Making Product A requires $\frac{3}{4}$kg of Chemical C and $\frac{1}{4}$kg of Chemical D per 1kg.
・Making Product B requires $\frac{2}{7}$kg of Chemical C and $\frac{5}{7}$kg of Chemical D per 1kg.
Product A sells for 1000 yukicoda per 1kg, and Product B sells for 2000 yukicoda per 1kg.
("Yukicoda" is the unit of currency of the Country of Yukicoda.)
You are given the amounts of Chemical C and Chemical D available for use.
Maximize the total selling price of the finished Product A and Product B.
Input
C D
C and D are the amounts of Chemical C and Chemical D, respectively. (Unit: kg)
C and D are positive integers. $1 \le$ C,D $\le 1000$.
Output
Output the maximum total selling price of Product A and Product B on one line.
The allowed error is an absolute or relative error of $10^{−6}$.
Do not forget the newline at the end.
Sample
Sample 1
Input
5 6
Output
18000
The available amounts are 5kg of Chemical C and 6kg of Chemical D.
Use 3kg of Chemical C and 1kg of Chemical D to make 4kg of Product A.
Use 2kg of Chemical C and 5kg of Chemical D to make 7kg of Product B.
Product A sells for 4000 yukicoda, and Product B sells for 14000 yukicoda.
Therefore, the expected selling price is 18000 yukicoda.
Sample 2
Input
3 7
Output
19692.3076923077
The input is given as integers, but the allocation of each chemical to each product need not be in integer units.
The finished products also may not be an integer number of kg. Fractional kg amounts are possible.
In this case, the 3kg of Chemical C and the 7kg of Chemical D are both used up.
Sample 3
Input
32 10
Output
40000
Making only Product A may yield a higher selling price.
Also, 2kg of Chemical C is left over. You do not have to use up all the materials.
Sample 4
Input
1000 1000
Output
3076923.0769230775
This is the largest case.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。