NEC Programming Contest 2021(AtCoder Beginner Contest 229) C - Cheese

在NEC Programming Contest 2021的AtCoder Beginner Contest 229中,问题C - Cheese涉及制作美味的奶酪比萨。程序员需要在不超过W克的限制下,从N种不同美味值的奶酪中选择,使得比萨的总美味值最大化。每种奶酪都有其固定美味值(Ai)和可用量(Bi)。通过排序和贪心策略,可以找出最佳的奶酪组合以达到最大美味值。
摘要由CSDN通过智能技术生成

题目链接:C - Cheese (atcoder.jp)

Problem Statement

Takahashi, who works for a pizza restaurant, is making a delicious cheese pizza for staff meals.
There are N kinds of cheese in front of him.
The deliciousness of the i-th kind of cheese is Ai​ per gram, and Bi​ grams of this cheese are available.
The deliciousness of the pizza will be the total deliciousness of cheese he puts on top of the pizza.
However, using too much cheese would make his boss angry, so the pizza can have at most W grams of cheese on top of it.
Under this condition, find the maximum possible deliciousness of the pizza.

Constraints

  • All values in input are integers.
  • 1≤N≤3×105
  • 1≤W≤3×108
  • 1≤Ai​≤109
  • 1≤Bi​≤1000

Input

Input is given from Standard Input in the following format

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值