#K64117. Solar Farm Energy Maximization
Solar Farm Energy Maximization
Solar Farm Energy Maximization
You are given a list of houses, where each house has a maximum capacity for installing solar panels, and a total budget. Each solar panel costs \(500\) dollars and generates \(100\) kilowatts of energy. Your task is to distribute the available panels among the houses such that:
- No house receives more panels than its capacity.
- The total number of panels does not exceed \(\lfloor\frac{\text{budget}}{500}\rfloor\), where the floor function represents integer division.
The goal is to maximize the total energy generated by the solar panels. The energy generated is calculated as:
\[ \text{Total Energy} = \text{(number of installed panels)} \times 100 \text{ kilowatts} \]
You should use a strategy that allocates panels in increasing order of house capacity to maximize overall energy production under the given constraints.
inputFormat
The input is given via standard input (stdin) with the following format:
- The first line contains two integers \(n\) and \(budget\), where \(n\) is the number of houses.
- The second line contains \(n\) space-separated integers representing the maximum number of solar panels that can be installed in each house.
Note: \(budget\) is provided in dollars and each panel costs \(500\) dollars.
outputFormat
Output a single integer via standard output (stdout) representing the maximum energy generated (in kilowatts) by installing the solar panels under the provided constraints.
## sample3 3500
2 3 5
700
</p>