#C9831. Maximum Revenue
Maximum Revenue
Maximum Revenue
In this problem, you are given a list of product prices and need to calculate the maximum revenue by selecting products for shipment. The store intends to consider only the top (k) most expensive products, and then ship at most (m) of these selected products. The revenue is then the sum of the prices of the shipped products. More formally, let the sorted list of prices (in descending order) be (p_1, p_2, \dots, p_n). The answer is computed as (\text{Revenue} = \sum_{i=1}^{\min(m,k)} p_i).
Task: Write a program that reads the number of products, the values of (k) and (m), and the list of product prices. The program should output the maximum revenue that can be achieved under these conditions.
inputFormat
The input is given via standard input and consists of two lines:
- The first line contains three space-separated integers (n), (k), and (m), where (n) is the total number of products, (k) is the number of top expensive products to consider, and (m) is the maximum number of products that can be shipped.
- The second line contains (n) space-separated integers representing the prices of the products.
outputFormat
Output a single integer representing the maximum revenue that can be achieved by shipping at most (m) products from the top (k) most expensive products. The output should be written to standard output.## sample
7 5 3
2 5 8 6 3 9 4
23
</p>