Problem :

Chef and robo-arm

Contest : Codetrix II

Probelm was pretty interesting but i am still unable to figure out the algorithm to solve this problem. Please can anyone help me to figure out the algorithm used to solve this problem

Also can any one please tell me how have they figured out that xyz algorithm should be used to solve this problem where by reading the problem statement it seems that one has to sort the input in descending order and then add the first ‘k’ variables and have to print the sum.

Please Help…!

Thanks in Advance…!!