Find Arrangements
Learn this problemProblem statement
Anju teaches Physics and Chemistry for P and C number of hours respectively. After teaching a particular subject for more than N number of hours continuously, Anju gets exhausted and needs to switch to another subject.
So the Principal has decided to schedule the time table for Anju in such a way that she does not teach a given subject for more than N number of hours continuously.
The principal being weak in maths asks you to find out the maximum number of possible arrangements of hours in which Anju can teach a given subject for no more than N number of hours continuously.
Input format
- First line contains
Tthe required number of test cases. - Next
Tlines contain Three space-separated integersP,C, andNrespectively.
Output format
For each test case, print the number of arrangements of hours in which Anju has not to teach a given subject for more than N number of hours continuously modulo 10^9+7.
Note: If no arrangement is possible print 0.
Function
findArrangements(P: int, C: int, N: int) → intExamples
Example 1
P = 1C = 1N = 2return = 2Example 2
P = 1C = 2N = 1return = 1Constraints
1 ≤ T ≤ 1001 ≤ P, C, N ≤ 10^3
More IBM problems
- Parent Process NumberOA · Seen Jul 2026
- Request Retry CountOA · Seen Jul 2026
- Count Strictly Increasing Subsequences of Length 3OA · Seen Jul 2026
- Maximum Requests in a Time WindowOA · Seen Jul 2026
- Query Type Frequency WindowOA · Seen Jul 2026
- Minimum Number of Non-Empty Disjoint SegmentsOA · Seen Jul 2026
- Spam Text ClassificationOA · Seen Jul 2026
- Count Ideal NumbersOA · Seen Jun 2026