C_RATING Editorial

PROBLEM LINK:

Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4

Setter: Lavish Gupta
Tester: Abhinav Sharma, Utkarsh Gupta
Editorialist: Pratiyush Mishra

DIFFICULTY:

651

PREREQUISITES:

None

PROBLEM:

Alice 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 Alice in finding out the minimum number of matches she needs to win in order to make her rating greater than or equal to Y?

EXPLANATION:

Given the current rating X and required rating Y, our answer would be simply the ceil of their difference divided by 8, since in each match we are covering the difference by 8.

answer = \lceil \frac{Y-X}{8} \rceil

TIME COMPLEXITY:

O(1), for each test case.

SOLUTION:

Editorialist’s Solution
Tester1’s Solution
Tester2’s Solution