adplus-dvertising

True and False Paper CodeChef Solution

We Are Discuss About CODECHEF SOLUTION

True and False Paper Codechef Solution

True and False Paper CodeChef Solution

Alice wrote an exam containing NN true or false questions (i.e. questions whose answer is either true or false). Each question is worth 11 mark and there is no negative marking in the examination. Alice scored KK marks out of NN.

Bob wrote the same exam but he marked each and every question as the opposite of what Alice did, i.e, for whichever questions Alice marked true, Bob marked false and for whichever questions Alice marked false, Bob marked true.

Determine the score of Bob.

Input Format

  • The first line contains a single integer TT — the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two space-separated integers NN and KK — the total number of questions in the exam and the score of Alice.

True and False Paper CodeChef Solution

Output Format

For each test case, output on a new line the score of Bob.

Constraints

  • 1T20001≤T≤2000
  • 1N1001≤N≤100
  • 0KN0≤K≤N

Sample Input 1 

3
1 1
50 0
100 76

Sample Output 1 

0
50
24

Explanation

True and False Paper CodeChef Solution

Test case 11: There was one question in the exam and Alice answered it correctly. This means that Bob will surely answer it incorrectly. Therefore Bob’s score is zero.

Test case 22: Alice answered all the questions incorrectly, and so Bob will surely answer all the questions correctly. Therefore Bob’s score is 5050.

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.