贪心之------Tea Party

这道题大致意思就是N个杯子的容积和茶壶的容积,要满足三个条件(1.每一个杯子里面的茶必须严格大于它容积的一半 2.茶壶往所有杯子到满水后没有生于地茶 3.所有的客人必须满意) 使客人满意的话,就是一个杯子里面的茶水必须大于任意一个容积小于它的杯子里面的茶水

Tea Party
Polycarp invited all his friends to the tea party to celebrate the holiday. He has n cups, one for each of his n friends, with volumes a1, a2, …, an. His teapot stores w milliliters of tea (w ≤ a1 + a2 + … + an). Polycarp wants to pour tea in cups in such a way that:

Every cup will contain tea for at least half of its volume
Every cup will contain integer number of milliliters of tea
All the tea from the teapot will be poured into cups
All friends will be satisfied.
Friend with cup i won’t be satisfied, if there exists such cup j that cup i contains less tea than cup j but ai > aj.

For each cup output how many milliliters of tea should be poured in it. If it’s impossible to pour all the tea and satisfy all conditions then outpu

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值