A7900 | Guilty — to the kitchen!
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 $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?
According to the borscht recipe it consists of $n$ ingredients that have to be mixed in proportion  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?
输入格式
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$ ).
输出格式
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}$ .
输入输出样例
输入 #1
1 100 1 40
输出 #1
40.0
输入 #2
2 100 1 1 25 30
输出 #2
50.0
输入 #3
2 100 1 1 60 60
输出 #3
100.0
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted