CodechefJun 10, 2025

Chess Ratings

Hazrat Ali

Codechef

Alice has recently started playing Chess. Her current rating is X. She noticed that when she wins a game, her rating increases by 88 points.

Can you help Alice in finding out the minimum number of games she needs to win in order to make her rating greater than or equal to YY?

Input Format

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

Output Format

For each test case, output the minimum number of games that Alice needs to win in order to make her rating greater than or equal to Y.

Constraints

  • 1≤T≤104
  • 1≤X≤Y≤104

Sample 1:

Input
4
10 10
10 17
10 18
10 19

Output
 
0
1
1
2

Solution

def minimum_games_to_reach_rating():
    T = int(input())  
    for _ in range(T):
        X, Y = map(int, input().split())
        diff = Y - X
        games = (diff + 7) // 8  
        print(games)


minimum_games_to_reach_rating()





Comments