Submit | All submissions | Best solutions | Back to list |
NAJEB - Annie’s 18th Birthday |
Today is Annie’s 18th birthday. So Uncle John has given her N boxes of chocolate as a gift. But there is a restriction; she can’t take all the boxes of chocolate. She can take exactly M boxes of chocolate and rest of the boxes will be given her younger brother. ith box contains xi chocolates. Now UncleJohn shuffles all the boxes. Now Annie chooses M boxes blindly. What is the maximum and minimum number of chocolate that she can get?
Input:
Input starts with an integer T (T≤100) denoting the number of test cases. Each case starts with two space separated integers N and M (1≤N≤1000), (1≤M≤N). Then next N line contains N integers, where ith integer denotes the number of chocolate xi(1≤ xi ≤1000) in the ith box.
Output:
For each case, print the case number, maximum and minimum number of chocolate that Annie can get.
Sample:
Input |
Output |
2
|
Case 1: 9 3
|
Authored By: Tanvir Hasan Anick
Added by: | Najmuzzaman |
Date: | 2014-10-25 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |