#abc229c. C - Cheese
C - Cheese
Score : points
问题描述
在一家比萨餐厅工作的高桥正在为员工制作美味的奶酪比萨。
他面前有 种不同的奶酪。
第 种奶酪每克的美味度为 ,且有 克可供使用。
比萨的美味度将是所选用奶酪美味度的总和。
然而,使用过多的奶酪会让他的老板生气,因此比萨上最多只能放 克奶酪。
在此条件下,请找出比萨可能达到的最大美味度。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi, who works for a pizza restaurant, is making a delicious cheese pizza for staff meals.
There are kinds of cheese in front of him.
The deliciousness of the -th kind of cheese is per gram, and 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 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.
Input
Input is given from Standard Input in the following format:
Output
Print the answer as an integer.
Sample Input 1
3 5
3 1
4 2
2 3
Sample Output 1
15
The optimal choice is to use gram of cheese of the first kind, grams of the second kind, and grams of the third kind.
The pizza will have a deliciousness of .
Sample Input 2
4 100
6 2
1 5
3 9
8 7
Sample Output 2
100
There may be less than grams of cheese in total.
Sample Input 3
10 3141
314944731 649
140276783 228
578012421 809
878510647 519
925326537 943
337666726 611
879137070 306
87808915 39
756059990 244
228622672 291
Sample Output 3
2357689932073
update @ 2024/3/10 10:01:07