A11696 | Watering System
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Arkady wants to water his only flower. Unfortunately, he has a very poor watering system that was designed for $n$ flowers and so it looks like a pipe with $n$ holes. Arkady can only use the water that flows from the first hole.
Arkady can block some of the holes, and then pour $A$ liters of water into the pipe. After that, the water will flow out from the non-blocked holes proportionally to their sizes $s_1, s_2, \ldots, s_n$ . In other words, if the sum of sizes of non-blocked holes is $S$ , and the $i$ -th hole is not blocked, $\frac{s_i \cdot A}{S}$ liters of water will flow out of it.
What is the minimum number of holes Arkady should block to make at least $B$ liters of water flow out of the first hole?
Arkady can block some of the holes, and then pour $A$ liters of water into the pipe. After that, the water will flow out from the non-blocked holes proportionally to their sizes $s_1, s_2, \ldots, s_n$ . In other words, if the sum of sizes of non-blocked holes is $S$ , and the $i$ -th hole is not blocked, $\frac{s_i \cdot A}{S}$ liters of water will flow out of it.
What is the minimum number of holes Arkady should block to make at least $B$ liters of water flow out of the first hole?
输入格式
The first line contains three integers $n$ , $A$ , $B$ ( $1 \le n \le 100\,000$ , $1 \le B \le A \le 10^4$ ) — the number of holes, the volume of water Arkady will pour into the system, and the volume he wants to get out of the first hole.
The second line contains $n$ integers $s_1, s_2, \ldots, s_n$ ( $1 \le s_i \le 10^4$ ) — the sizes of the holes.
The second line contains $n$ integers $s_1, s_2, \ldots, s_n$ ( $1 \le s_i \le 10^4$ ) — the sizes of the holes.
输出格式
Print a single integer — the number of holes Arkady should block.
输入输出样例
输入 #1
4 10 3 2 2 2 2
输出 #1
1
输入 #2
4 80 20 3 2 1 4
输出 #2
0
输入 #3
5 10 10 1000 1 1 1 1
输出 #3
4
In the first example Arkady should block at least one hole. After that, $\frac{10 \cdot 2}{6} \approx 3.333$ liters of water will flow out of the first hole, and that suits Arkady.
In the second example even without blocking any hole, $\frac{80 \cdot 3}{10} = 24$ liters will flow out of the first hole, that is not less than $20$ .
In the third example Arkady has to block all holes except the first to make all water flow out of the first hole.
In the second example even without blocking any hole, $\frac{80 \cdot 3}{10} = 24$ liters will flow out of the first hole, that is not less than $20$ .
In the third example Arkady has to block all holes except the first to make all water flow out of the first hole.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted