A8053 | Snow sellers
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
The New Year celebrations in Berland last $n$ days. Only this year the winter is snowless, that’s why the winter celebrations’ organizers should buy artificial snow. There are $m$ snow selling companies in Berland. Every day the $i$ -th company produces $w_{i}$ cubic meters of snow. Next day the snow thaws and the company has to produce $w_{i}$ cubic meters of snow again. During the celebration new year discounts are on, that’s why the snow cost decreases every day. It is known that on the first day the total cost of all the snow produced by the $i$ -th company is equal to $c_{i}$ bourles. Every day this total cost decreases by $a_{i}$ bourles, i.e. on the second day it is equal to $c_{i}-a_{i}$ ,and on the third day — to $c_{i}-2a_{i}$ , and so on. It is known that for one company the cost of the snow produced by it does not get negative or equal to zero. You have to organize the snow purchase so as to buy every day exactly $W$ snow cubic meters. At that it is not necessary to buy from any company all the snow produced by it. If you buy $n_{i}$ cubic meters of snow ( $0<=n_{i}<=w_{i}$ , the number $n_{i}$ is not necessarily integer!) from the $i$ -th company at one of the days when the cost of its snow is equal to $s_{i}$ , then its price will total to  bourles. During one day one can buy the snow from several companies. In different days one can buy the snow from different companies. It is required to make the purchases so as to spend as little money as possible. It is guaranteed that the snow produced by the companies will be enough.
输入格式
The first line contains integers $n$ , $m$ and $W$ ( $1<=n<=100$ , $1<=m<=500000$ , $1<=W<=10^{9}$ ) which represent the number of days, the number of companies and the amount of snow that needs to be purchased on every one of the $n$ days. The second line contains $m$ integers $w_{i}$ . The third line contains $m$ integers $c_{i}$ . The fourth line contains $m$ integers $a_{i}$ . All the numbers are strictly positive and do not exceed $10^{9}$ . For all the $i$ the inequation $c_{i}-(n-1)a_{i}>0$ holds true.
输出格式
Print a single number — the answer to the given problem. Print the answer in the format with the decimal point (even if the answer is integer, it must contain the decimal point), without "e" and without leading zeroes. The answer should differ with the right one by no more than $10^{-9}$ .
输入输出样例
输入 #1
2 3 10 4 4 4 5 5 8 1 2 5
输出 #1
22.000000000000000
输入 #2
100 2 1000000000 999999998 999999999 1000000000 1000000000 1 1
输出 #2
99999995149.999995249999991
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted