#K49672. Maximum Array Value After Operation
Maximum Array Value After Operation
Maximum Array Value After Operation
Given an array of n integers and two additional integers p and m, determine the maximum possible value in the array after performing at most p multiplication operations. You are allowed to choose any element from the array. If at least one operation is permitted (p \ge 1), you can multiply the chosen element by m. Otherwise, if no operations can be performed (p = 0), the answer is simply the maximum element in the array.
In mathematical notation, the result is defined as follows:
$$\text{result} = \begin{cases} \max(a) & \text{if } p = 0,\\ m \times \max(a) & \text{if } p \ge 1. \end{cases}$$
inputFormat
The input consists of two lines. The first line contains three space-separated integers: n (the number of elements in the array), p (the number of operations allowed), and m (the multiplier). The second line contains n space-separated integers representing the elements of the array.
outputFormat
Output a single integer: the maximum possible value in the array after applying the allowed multiplication operation, if any.
## sample3 2 3
2 5 7
21