Watering System

Arkady wants to water his only flower. Unfortunately, he has a very poor watering system that was designed for 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 s1,s2,…,sn. In other words, if the sum of sizes of non-blocked holes is S, and the i-th hole is not blocked, si⋅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?

Input

 

The first line contains three integers nn, A, B (1≤n≤1000001≤n≤100000, 1≤B≤A≤10000) — 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 s1,s2,…,sn (1≤si≤10000) — the sizes of the holes.

Output

Print a single integer — the number of holes Arkady should block. 

 Examples

Input

4 10 3
2 2 2 2

Output

1

Input

4 80 20
3 2 1 4

Output

0

Input

5 10 10
1000 1 1 1 1

Output

4

 题目大意:就是给你三个数,分别是洞的个数、总的水量和要从第一个洞里流出的水的量。那么这显然是一个数学题,题目是要求用最少的堵洞数,那么我们就先把洞的大小按从大到小的顺序排序,再依次堵住最大的那个洞,计算出水流量大于等于给出的数据B即可。就根据这个 si⋅A/S 进行计算就行了 。

代码如下:

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
const int maxn=1e6+5;
double dis[maxn];
int cmp(int a,int b)
{
	return a>b;
}
int main()
{
	double m,a,b;
	int n;
	while(scanf("%d%lf%lf",&n,&a,&b)!=EOF)
	{
		double sum=0;
		for(int i=0;i<n;i++)
		{
			scanf("%lf",&dis[i]);
			sum+=dis[i];
		} 
		sort(dis+1,dis+n,cmp);
		double num=dis[0],d=0;
		for(int i=1;i<n;i++)
		{
			if(num==dis[0])
			{
				if((dis[0]*a/sum)>=b)
				break;
			}
			sum-=dis[i];
			double k=(num*a/sum);
			d++;
			if(k>=b)
			{
				break;
			}
		}
		printf("%.lf\n",d);
	}
	return 0;
}

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值