Friday, April 8, 2022

The Cooler Dilemma 2

 The summer is at its peak in Chefland. Chef is planning to purchase a water cooler to keep his room cool. He has two options available:

  • Rent a cooler at the cost of
  • coins per month.
  • Purchase a cooler for
    • coins.

    Chef wonders what is the maximum number of months for which he can rent the cooler such that the cost of renting is strictly less than the cost of purchasing it.

    Input Format

    • The first line of input will contain an integer
    — the number of test cases. The description of
  • test cases follows.
  • The first and only line of each test case contains two integers
  • and
    • , as described in the problem statement.

    Output Format

    For each test case, output the maximum number of months for which he can rent the cooler such that the cost of renting is strictly less than the cost of purchasing it.

    If Chef should not rent a cooler at all, output

    .

    Constraints

    Sample Input 1

    2
    5 12
    5 5
    

    Sample Output 1

    2
    0
    

    Explanation

    Test case

    : Cost of renting the cooler coins per month. Cost of purchasing the cooler coins. So, Chef can rent the cooler for months at the cost of coins, which is strictly less than

    coins.

    Test case

    : Cost of renting the cooler coins per month. Cost of purchasing the cooler coins. If Chef rents the cooler for month, it will cost coins, which is not strictly less than the cost of purchasing it. So, Chef should not rent the cooler.  

    No comments:

    Post a Comment

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

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