#P42A. Guilty — to the kitchen!
Guilty — to the kitchen!
题目描述
今天对Volodya来说是十分不幸的一天。他的代数考试挂掉了,并且不得不在厨房里干活,即做罗宋汤(一种传统的俄罗斯汤)。通过这样也能提高他的代数水平。
根据罗宋汤的配方,罗宋汤由n部分组成,并且它们必须按比例()混合(因此,对于一个非负的x,它们为升),在厨房里 Volodya发现每种配料他相应的有升供他使用。为了纠正他在代数上的错误,他决定用一个容量为V升的锅尽可能的多做汤(这意味着这它最多能够做V升的汤)。Volodya最多能做多少汤?
输入格式:
第一行包含两个用空格分开的整数n和V()。下一行包含n个用空格分开的整数()。 最后一行包含n个空格分开的整数()
输出格式:
你的程序应当仅仅输出一个实数 — Volodya最多能做的汤的体积。你的答案必须和标准答案相差不超过
Description
It's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This should also improve his algebra skills.
According to the borscht recipe it consists of n ingredients that have to be mixed in proportion litres (thus, there should be a1 ·x, ..., an ·x litres of corresponding ingredients mixed for some non-negative x). In the kitchen Volodya found out that he has b1, ..., bn litres of these ingredients at his disposal correspondingly. In order to correct his algebra mistakes he ought to cook as much soup as possible in a V litres volume pan (which means the amount of soup cooked can be between 0 and V litres). What is the volume of borscht Volodya will cook ultimately?
The first line of the input contains two space-separated integers n and V (1 ≤ n ≤ 20, 1 ≤ V ≤ 10000). The next line contains n space-separated integers ai (1 ≤ ai ≤ 100). Finally, the last line contains n space-separated integers bi (0 ≤ bi ≤ 100).
Your program should output just one real number — the volume of soup that Volodya will cook. Your answer must have a relative or absolute error less than 10 - 4.
Input
The first line of the input contains two space-separated integers n and V (1 ≤ n ≤ 20, 1 ≤ V ≤ 10000). The next line contains n space-separated integers ai (1 ≤ ai ≤ 100). Finally, the last line contains n space-separated integers bi (0 ≤ bi ≤ 100).
Output
Your program should output just one real number — the volume of soup that Volodya will cook. Your answer must have a relative or absolute error less than 10 - 4.
Samples
1 100
1
40
40.0
2 100
1 1
25 30
50.0
2 100
1 1
60 60
100.0
样例1:比例是1,所以最多能做1*40升,答案为40。
样例2:比例为1:1,所以最多能做1升,答案50。
样例3:比例为1:1,所以最多能做1升,因为锅最大是100升,所以是100。
相关
在以下作业中: