Milly's Rank
Practice
3.4 (270 votes)
Ready
Mathematics
Approved
Easy
Problem
26% Success 6056 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Milly is very much concern about her rank in her class. So to make her feel better , her friend Pranjul will give three numbers to her denoting N, X and Y. N represents the total number of students in the class. Now he has already described about the rank predictor algorithm that he has made for her. According to this algorithm, there are no less than X people who are better than her and no more than Y people are worse than her. Your task is to print the number of different ranks that she can predict using Pranjul's algorithm.
Input
- First line will have a value of T (No. of test cases).
- Then for every test case there will be one line containing three space separated values of
N, X and Y.
Output
- For every test case print the required answer in a new line.
Constraints
- 1 ≤ T ≤ 105.
- 0 ≤ X, Y ≤ N ≤ 1018.
Submissions
Please login to view your submissions
Similar Problems
1.Ratio
Points:30
28 votes
Tags:
AdhocBasic ProgrammingBasics of ImplementationImplementationMedium
Points:30
Tags:
MediumNumber TheoryGreatest common divisorAlgorithmsMathematicsOpenApproved
Points:30
1 votes
Tags:
Hash functionData StructuresEasy-MediumMathematicsapprovedFactorization
Editorial