#P1984. [SDOI2008] 烧水问题
[SDOI2008] 烧水问题
Description
A total mass of of water is divided into cups, each containing of water, all initially at degrees. We need to bring every cup of water to a boil. We may heat any cup. The energy required to raise one cup’s temperature by degrees is , where is the energy unit "joule". Once a cup’s temperature reaches degrees, it cannot be heated further; at that point we consider this cup to have been boiled. Clearly, if we simply boil the cups one by one directly, the total energy required is .
During the process, we may perform heat transfer between any two cups at different temperatures at any time. Heat can only flow from the hotter cup to the cooler cup. Since the two cups have equal mass, after a heat transfer operation, the temperature decrease of the originally hotter cup always equals the temperature increase of the originally cooler cup.
Heat transfer stops immediately once the two cups reach the same temperature.
To simplify the problem, assume:
- When neither heating nor heat transfer is being performed, water temperature does not change.
- All energy spent on heating is absorbed by the water; the cup absorbs no energy.
- Heat transfer always occurs through the cup walls; the cups of water never mix.
- Heat transfer conserves energy and has no loss.
In this problem, it is only required that each cup be brought to a boil at least once; it is not required that every cup ends at degrees. For example, we can boil two cups as follows: first heat one cup to degrees, costing , then perform heat transfer between the two cups until both are at degrees, and finally heat the cup that was not previously brought to degrees up to degrees, costing . At this point, both cups have been boiled; the current temperatures are one at degrees and one at degrees. The total energy spent is , which is less than the required by direct boiling.
Your task is to design an optimal sequence of operations that minimizes the total energy required to ensure that all cups are each boiled at least once.
Input Format
One line containing an integer .
Output Format
Output the minimal total energy required to boil all cups at least once, in , rounded to two decimal places.
2
315000.00
Hint
Constraints
For all testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号