【ZOJ3916 2016年浙大2月月赛B】【贪心 STL-SET】Buy Cakes n蛋糕k张折扣券蛋糕双价最多能买蛋糕数

这是一道关于计算在有限金钱下,利用折扣券购买蛋糕最大数量的问题。题目给出多组数据,每组包含蛋糕数量、折扣券数量和总金额,以及每个蛋糕的原价和优惠后的价格。求解在利用所有折扣券的情况下,最多能买多少蛋糕。
摘要由CSDN通过智能技术生成
Buy Cakes

Time Limit: 2 Seconds        Memory Limit: 65536 KB

Andy is always a hungry man. He never stopped eating something sweet, expecially cakes.

Yesterday his mother gave him some pocket money, and now, he has M dollars all together.

The cake shop provides N pieces of cakes, and each of them costs ai dollars respectively.

Fortunately, Andy has K discount coupons for that cake shop. When we use a coupon, we can buy a cake at a lower prize of bi dollars instead of the original ai dollars.

So, Andy wants you to help him find out how many cakes he can buy at most.

Input

There are multiple cases.

The first line contains the number of cases for this problem T (1<=T<=10).

For each case, the first line contains three integers N (1<=N<=105), 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值