We Are Discuss About CODECHEF SOLUTION
Passing Marks CodeChef Solution
Passing Marks CodeChef Solution
Problem
In a class of � students, a class test was held. The ��āĀ student scored �� marks. It is also known that the scores of all students wereĀ distinct.
A student passes the test if their score is strictly greater than the passing mark. Given that exactly � students pass in the test, find the maximum value of the passing mark of the test.
Input Format
- The first line of input will contain a single integerĀ ļæ½, denoting the number of test cases.
- Each test case consists of multiple lines of input.
- The first line of each test case contains two space-separated integers � and � ā the number of students in the class and the number of students that passed in the test.
- The next line contains � space-separated integersĀ ļæ½1,ļæ½2,ā¦,��, where the ��āĀ integer denotes the marks of the ��āĀ student.
Output Format
For each test case, output on a new line, theĀ maximumĀ value of the passing mark of the test.
Constraints
- 1ā¤ļæ½ā¤100
- 1ā¤ļæ½ā¤100
- 1ā¤ļæ½ā¤ļæ½
- 1ā¤ļæ½ļæ½ā¤100
- All elements of array � are distinct.
Sample 1:
3 2 2 5 1 4 1 5 1 7 4 4 3 15 70 100 31
0 6 30
Explanation:
Test caseĀ 1:Ā Since both students pass the test, both students scored greater than passing marks. The maximum value of passing marks can beĀ 0, as both students have marks greater thanĀ 0.
Test caseĀ 2:Ā Only one student passes the test. Thus, the third student has passed the test by scoringĀ 7Ā marks. The passing marks of the test isĀ 6.
Test caseĀ 3:Ā Since three students pass the test, studentsĀ 2,3,Ā andĀ 4Ā scored greater than passing marks. The maximum value of passing marks can beĀ 30, three students have marks greater thanĀ 30.
SOLUTION
Here Discuss About Solve Passing Marks CodeChef Solution
SOLUTION
Passing Marks CodeChef Solution
SOLUTION
Yhaa You have done it but next? if YOU Want to Get Others Please Visit HereĀ ScishowEngineerĀ Ā ThenĀ Follow US HEREĀ andĀ Join Telegram.
If You Want To Learn Something New Then Visit OurĀ Official Channel YOUTUBE