博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CodeForces 42A Guilty — to the kitchen!
阅读量:7294 次
发布时间:2019-06-30

本文共 1916 字,大约阅读时间需要 6 分钟。

 Guilty — to the kitchen!
Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u
Submit     

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?

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.

Sample Input

Input
1 100 1 40
Output
40.0
Input
2 100 1 1 25 30
Output
50.0
Input
2 100 1 1 60 60
Output
100.0
1 #include 
2 #include
3 #include
4 using namespace std; 5 struct Node 6 { 7 double a; 8 double b; 9 double c;10 }s[25];11 12 bool cmp(Node x,Node y)13 {14 return x.c
v)34 ans=v;35 printf("%lf\n",ans);36 }37 return 0;38 }
View Code

 

转载于:https://www.cnblogs.com/cyd308/p/4771510.html

你可能感兴趣的文章
我的友情链接
查看>>
BUG管理系统(Mantis)迁移实录
查看>>
20161011L04-03老男孩linux运维实战培训-Linux系统的用户和用户组管理-01
查看>>
我的友情链接
查看>>
oracle表空间操作详解
查看>>
Oracle从零开始04——SQL语句03——单行函数
查看>>
C语言数组名和指针
查看>>
帧中继配置
查看>>
eclipse安装快速打开项目所在位置的插件
查看>>
Python爬虫框架Scrapy 学习笔记 6 ------- 基本命令
查看>>
lvm快照的创建恢复
查看>>
数学之美笔记(二十)
查看>>
网站设计八步骤
查看>>
Oracle系统用户的默认密码及功能
查看>>
获取数组中的最大值
查看>>
Operation category READ is not supported in state standby
查看>>
elasticsearch 6.6 安装(CentOS 7.5) 修订
查看>>
python进阶资源整理
查看>>
对Struts2的认识(-)
查看>>
25个经典的Spring面试问答
查看>>