Chess Rating
Sam has recently started playing Chess. Her current rating is X. She noticed that when she wins a game, her rating increases by 8 points. Can you help sam in finding out the minimum number of games she needs to win in order to make her rating greater than or equal to Y? Input:-4 10 10 10 17 10 18 10 19 Input Description: 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: 0 1 1 2 Output Description: For each test case, output the minimum number of games that sam needs to win in order to make her rating greater than or equal to Y. Constraints: 1<=T<=10 ^4 1<=X<=Y<=10^4 Explanation: Test case 1: Since Sam's current rating X is already equal to her desired rating Y, she doesn't need to win any game. Test case 2: Sam's current rating is 10. After winning 1 game, her rating will become 10+8=18, which is greater than her desired rating of 17. Thus, she has to win at least 1 game. Test case 3: Sam's current rating is 10. After winning 1 game, her rating will become 10+8=18, which is equal to her desired rating of 18. Thus, she has to win at least 1 game. Test case 4: Sam's current rating is 10. After winning 1 game, her rating will become 18, which is less than her desired rating of 19. She will need to win one more game in order to make her rating 26, which is greater than 19. Thus, she has to win at least 2 games
Loading...