#P16819. [蓝桥杯 2026 国 Python B] 最小耗水定额
[蓝桥杯 2026 国 Python B] 最小耗水定额
Problem Description
The construction of national reserve forests has been included in the national plan. During the project implementation, a certain region plans to build ecological forest areas, and the expected water-use quota of the -th area is .
To optimize resource allocation, the water resources department provides two compensation plans. The company can divide these forest areas into several batches for construction (each forest area must belong to exactly one batch, and the grouping does not need to keep the original order):
- Step-by-step construction mode: If a batch contains fewer than forest areas, then each forest area in this batch can receive a subsidy of units of resources (that is, its actual water-use quota is ).
- Intensive construction mode: If a batch contains exactly forest areas, then the forest area with the smallest water-use quota in this batch is completely free (its actual water use is ), while the other forest areas in this batch must consume according to the original quotas and no longer enjoy the -unit quota subsidy.
According to the rules, each batch can contain at most forest areas.
As the project leader, please design an optimal batching plan so that the total water-use quota required to complete the construction of all forest areas is minimized.
Input Format
The first line contains three integers , representing the number of forest areas, the threshold size for the intensive mode, and the quota subsidy for the step-by-step mode.
The second line contains integers , representing the original water-use quotas of each forest area.
Output Format
Output one integer, representing the minimum total water-use quota required to complete the construction.
5 3 20
10 20 30 40 50
60
Hint
[Test Case Scale and Assumptions]
For of the test cases, , .
For all test cases, , , , .
Translated by ChatGPT 5