PROBLEM LINK:
Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4
Setter: Abhinav Gupta
Tester: Satyam, Tejas Pandey
Editorialist: Pratiyush Mishra
DIFFICULTY:
281
PREREQUISITES:
None
PROBLEM:
There is a cricket match going on between two teams A and B.
Team B is batting second and got a target of X runs. Currently, team B has scored Y runs. Determine how many more runs Team B should score to win the match.
Note: The target score in cricket matches is one more than the number of runs scored by the team that batted first.
EXPLANATION:
Current score of team B = Y
Target score of Team B = X
In order for team B to win, it needs to have a score of X, thus extra runs that team B needs to score to win are:
X-Y
TIME COMPLEXITY:
O(1), for each test case.
SOLUTION:
Editorialist’s Solution
Tester1’s Solution
Tester2’s Solution