[Solution] Joining Date CodeChef Solution | CodeChef Problem Solution 2022
candidates (numbered from to ) join Chef's firm. The first candidates join on the first day, and then, on every subsequent day, the next candidates join in.
For example, if there are candidates, candidates numbered to will join on day , candidates numbered to on day and the remaining candidates will join on day .
Candidate numbered decided to turn down his offer and thus, Chef adjusts the position by shifting up all the higher numbered candidates. This leads to a change in the joining day of some of the candidates.
Help Chef determine the number of candidates who will join on a different day than expected.
Input Format
- First line will contain , number of test cases. Then the test cases follow.
- Each test case contains of a single line of input, two space-separated integers and denoting the number of candidates and the candidate who turned down the offer.
Output Format
For each test case, output a single integer denoting the number of candidates whose joining day
Waiting Time CodeChef Solution
Joining Date CodeChef Solution
Distinct Palindrome CodeChef Solution
The Optimal Pairs CodeChef Solution
Make them Equal CodeChef Solution
Permutation AND CodeChef Solution
will be changed.
No comments:
Post a Comment