Passing Marks CodeChef Solution

We Are Discuss About CODECHEF SOLUTION

Passing Marks CodeChef Solution

Passing Marks CodeChef Solution

Answers will be Uploaded Shortly and it will be Notified on Telegram, SoĀ JOIN NOW
JoinScishowEngineerTelegram

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:

Input

Output

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.

Answers will be Uploaded Shortly and it will be Notified on Telegram, SoĀ JOIN NOW
JoinScishowEngineerTelegram

 

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

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *