-
Notifications
You must be signed in to change notification settings - Fork 0
Lists : Sample Problem 1
The Gocargo carriers want to improvise their financial targets this annual year. They have planned to increase the container's profit value. Given the profit values of the cargos and the capacity of the container, determine the maximum profit value that the container can yeild.
Input format: The first line of input consists of a comma separated list of integers, profit values of cargos. The second line of input consists of an integer, which corresponds to the container’s capacity.
Assume: All profit values are unique.
Output format: Output is an integer, the maximum profit value of the container.
Sample Input 1:
12,4,15,30,40
3
Sample Output 1:
85
Explanation for the sample: The capacity of the container is 3. The top 3 profitable cargos are 40, 30 and 15. Therefore, total profit = 85.