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 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;
}