#abc332g. G - Not Too Many Balls
G - Not Too Many Balls
Score : points
问题描述
存在若干个球,每个球的颜色为 , , , 中的一种,且对于每个 ,有 个颜色为 的球。
另外,存在 个盒子。对于每 ,第 个盒子最多可容纳总共 个球。
在此条件下,对于所有满足 和 的整数对 ,第 个盒子最多可容纳 个颜色为 的球。
请输出这 个盒子最多能容纳的球的总数。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are several balls. Each ball is one of the colors , , , , and for each , there are balls of color .
Additionally, there are boxes. For each , the -th box can hold up to balls in total.
Here, for all pairs of integers satisfying and , the -th box may hold at most balls of color .
Print the maximum total number of balls that the boxes can hold.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
2 3
8 10
4 3 8
Sample Output 1
14
You can do as follows to put a total of balls into the boxes while satisfying the conditions in the problem statement.
- For balls of color , put one into the first box, one into the second box, and three into the third box.
- For balls of color , put two into the first box, two into the second box, and five into the third box.
Sample Input 2
1 1
1000000000000
0
Sample Output 2
0
Sample Input 3
10 12
59 168 130 414 187 236 330 422 31 407
495 218 351 105 351 414 198 230 345 297 489 212
Sample Output 3
2270
update @ 2024/3/10 01:19:06