Wednesday, March 30, 2022

Volume Control

 Chef is watching TV. The current volume of the TV is 

. Pressing the volume up button of the TV remote increases the volume by while pressing the volume down button decreases the volume by . Chef wants to change the volume from to

. Find the minimum number of button presses required to do so.

Input Format

  • The first line contains a single integer
  • - the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two integers
  • and
    • - the initial volume and final volume of the TV.

    Output Format

    For each test case, output the minimum number of times Chef has to press a button to change the volume from

    to

    .

    Constraints

    Sample Input 1

    2
    50 54
    12 10
    

    Sample Output 1

    4
    2
    

    Explanation

    Test Case 1: Chef can press the volume up button

    times to increase the volume from to

    .

    Test Case 2: Chef can press the volume down button

    times to decrease the volume from to .

    No comments:

    Post a Comment

    मुझे दिल में बसाना आसान नहीं....

    पता है Recently i realised की मुझे दिल में बसाना आसान नहीं है बात-बात पे चिढ़ जाती हूं मैं दिल लगा लूं एक बार तो फिर ज़िद पे अड़...