adplus-dvertising

Math1 Enrolment CodeChef Solution

We Are Discuss About CODECHEF SOLUTION

Math1 Enrolment CodeChef Solution

Math1 Enrolment CodeChef Solution

For the upcoming semester, the admins of your university decided to keep a total of XX seats for the MATH-1 course. A student interest survey was conducted by the admins and it was found that YY students were interested in taking up the MATH-1 course.

Find the minimum number of extra seats that the admins need to add into the MATH-1 course to make sure that every student who is interested in taking the course would be able to do so.

Input Format

  • The first line of input will contain a single integer¬†TT, denoting the number of test cases.
  • Each test case consists of two-space separated integers on a single line,¬†XX¬†and¬†YY¬†‚ÄĒ the current number of seats up for enrolment and the number of students interested in taking up the course in the upcoming semester, respectively.

Math1 Enrolment CodeChef Solution

Output Format

For each test case, output on a new line the minimum number of seats required to be added.

Constraints

  • 1‚ȧT‚ȧ1001‚ȧT‚ȧ100
  • 1‚ȧX,Y‚ȧ1051‚ȧX,Y‚ȧ105

Sample Input 1 

4
1 1
12 34
50 49
49 50

Sample Output 1 

0
22
0
1

Explanation

Math1 Enrolment CodeChef Solution

Test case 11: Exactly 11 seat is available for enrolment, and exactly 11 student is interested in taking up the course, hence addition of more seats is not required.

Test case¬†22:¬†1212¬†seats are available for enrolment but¬†3434¬†students are interested in taking up the course, hence the admins would have to add¬†34‚ąí12=2234‚ąí12=22¬†more seats to make sure that every student interested in the course gets a seat.

Test case 33: 5050 seats are available for enrolment and 4949 students are interested in taking up the course, hence addition of more seats is not required.

Test case¬†44:¬†4949¬†seats are available for enrolment, but¬†5050¬†students are interested in taking up the course, hence the admins would have to add¬†50‚ąí49=150‚ąí49=1¬†more seat to make sure that every student interested in the course gets a seat.

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

One thought on “Math1 Enrolment CodeChef Solution

  1. You actually make it seem so easy with your presentation but I find this matter to be really something which I think I would never understand. It seems too complex and very broad for me. I am looking forward for your next post, I’ll try to get the hang of it!

Leave a Reply

Your email address will not be published.