Codeforces Beta Round 41
A
有罪——去厨房!
Guilty — to the kitchen!
Codeforces
1400
原题
←B →

有罪——去厨房!AI (CI翻译)

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.

今天对 Volodya 来说真是不幸。他的代数考试得了低分,因此被迫去厨房干活,也就是煮罗宋汤(一种传统的俄罗斯汤)。这也应该能提高他的代数水平。AI (CI翻译)

According to the borscht recipe it consists of $*n*$ ingredients that have to be mixed in proportion image litres (thus, there should be $*a*_{1} ·*x*, ..., *a*_{*n*} ·*x*$ litres of corresponding ingredients mixed for some non-negative $*x*$). In the kitchen Volodya found out that he has $*b*_{1}, ..., *b*_{*n*}$ 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?

按照罗宋汤的配方,它由 $*n*$ 种食材组成,各种食材必须按比例 image 混合(也就是说,对于某个非负数 $*x*$,应分别混合 $*a*_{1} ·*x*, ..., *a*_{*n*} ·*x*$ 升对应食材)。Volodya 在厨房里发现,他分别有 $*b*_{1}, ..., *b*_{*n*}$ 升这些食材。为了弥补代数上的错误,他应当尽可能多地煮汤,但锅的容量为 $*V*$ 升(也就是说,煮出的汤量可以在 $0$ 到 $*V*$ 升之间)。最终 Volodya 会煮出多少升罗宋汤?AI (CI翻译)

Input

输入格式

AI (CI翻译)

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 $*a*_{*i*}$ ($1 ≤ *a*_{*i*} ≤ 100$). Finally, the last line contains $*n*$ space-separated integers $*b*_{*i*}$ ($0 ≤ *b*_{*i*} ≤ 100$).

输入的第一行包含两个以空格分隔的整数 $*n*$ 和 $*V*$($1 ≤ *n* ≤ 20, 1 ≤ *V* ≤ 10000$)。第二行包含 $*n*$ 个以空格分隔的整数 $*a*_{*i*}$($1 ≤ *a*_{*i*} ≤ 100$)。最后一行包含 $*n*$ 个以空格分隔的整数 $*b*_{*i*}$($0 ≤ *b*_{*i*} ≤ 100$)。AI (CI翻译)

Output

输出格式

AI (CI翻译)

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}$.

程序应仅输出一个实数,即 Volodya 将煮出的汤的体积。答案的相对误差或绝对误差必须小于 $10^{ - 4}$。 AI (CI翻译)

样例

Input #1
1 100
1
40
Output #1
40.0
InputCopy OutputCopy
Input #2
2 100
1 1
25 30
Output #2
50.0
InputCopy OutputCopy
Input #3
2 100
1 1
60 60
Output #3
100.0
InputCopy OutputCopy
题目信息
题号
42A
时间限制
2 s
内存限制
256 MB
标签
贪心
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。