Watering System (贪心)

Arkady wants to water his only flower. Unfortunately, he has a very poor watering system that was designed for nn flowers and so it looks like a pipe with nn holes. Arkady can only use the water that flows from the first hole.

Arkady can block some of the holes, and then pour AA liters of water into the pipe. After that, the water will flow out from the non-blocked holes proportionally to their sizes s1,s2,,sns1,s2,…,sn. In other words, if the sum of sizes of non-blocked holes is SS, and the ii-th hole is not blocked, siASsi⋅AS liters of water will flow out of it.

What is the minimum number of holes Arkady should block to make at least BB liters of water flow out of the first hole?

Input

The first line contains three integers nnAABB (1n1000001≤n≤1000001BA1041≤B≤A≤104) — 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 nn integers s1,s2,,sns1,s2,…,sn (1si1041≤si≤104) — 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
Note

In the first example Arkady should block at least one hole. After that, 10263.33310⋅26≈3.333liters of water will flow out of the first hole, and that suits Arkady.

In the second example even without blocking any hole, 80310=2480⋅310=24 liters will flow out of the first hole, that is not less than 2020.

In the third example Arkady has to block all holes except the first to make all water flow out of the first hole. 

                               

#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
int arr[N];
int cmp(int a,int b){
	return a>b;
}
int main(){
	int n,A,B;
	scanf("%d%d%d",&n,&A,&B);
	int sum=0;
	for(int i=0;i<n;i++){
	   scanf("%d",&arr[i]);	
	   sum+=arr[i];
	}
    sort(arr+1,arr+n,cmp);
	int ans=0;
    if((A*arr[0]/sum)>=B) ans=0;
    else{
    	for(int i=1;i<n;i++){
    		if((A*arr[0]/sum)>=B) break;
    		sum-=arr[i];
    		ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
SUIMONO Water System是Unity互动式水系统,专门为我们提供了先进且深度可定制的海洋和水分效应,需要Unity 5.0.0或更高版本。 现实的水渲染 – Suimono 2.0为我们的Unity项目带来先进而现实的水和海洋渲染 高级FX – 具有镶嵌(dx11),泡沫渲染,动态反射,折射和屏幕转换 场景交互 – 设置任何游戏对象,用于交互式效果,如飞溅,折射波纹,声音和高级浮力效果 水下FX – 自动水下渲染,包括深度雾化,高级焦散,模糊和屏幕折射 定制 – 可以控制水景观和行为的各个方面 SUIMONO Water System v2.1.6更新日志: 2.1.6 (当前)已发布 2018年8月16日 WHAT’S NEW: – Added ‘Clear Mode’ option to camera tools. Allows override of clear flag inheritance on reflection camera. CHANGES: – Raised default Buoyancy activation range to 5000. – Added Mesh Collider to farplane surface prefab. Helps prevent Buoyancy detection fail. – Underwater camera component is no longer added if underwater rendering is turned off on module. BUG FIXES: – Fixed shader errors under PS4 that were preventing build completion (Lerp/Dot ambiguity). – Fixed Depthmask2 shader over-bright error. – Fixed object editor issue when expanding tabs. – Fixed bug where editor was showing wrong skin color (dark/pro skin vs light skin). – Reflection Color setting now affects underwater reflection as well. – Adjusted Caustic lighting code so it doesn’t reduce to 0 intensity. – Removed buoyancy frustum occlusion code causing strange buoyancy errors. – Fixed screen uv edge smearing underwater and with water droplet effects. – Fixed Underwater surface flickering error. – Fixed underwater transparency over-bright error. – Fixed Reflection over-bright error. – Darkened underwater fog color matching.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值