Dexter and Mandark
Practice
4 (11 votes)
Algorithms
Approved
Completed
Medium
Open
Problem
90% Success 2561 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Dexter and Mandark are playing a game. The game consists of N rounds. After each round, the winner (either Dexter or Mandark) will be awarded one point. The player with more points at the end of the game wins.

Mandark is Dexter's arch enemy. Dexter wants to prove that he is superior to Mandark.
He wants that after each round in the game he has atleast M times the points that Mandark has.
Dexter is busy planning his game strategy so he asks you to tell him the number of ways he can win the game with the condition just described.

Two ways of winning the game are said to be different if some round is won by a different person.

Input:
The first line contains T, the number of test cases.
Each test case consists of a single line with two space separated integers N and M.

Output:
For each test case, output the answer modulo 10^9 + 7

Constraints:

1<=T<=10
1<=M<=N<=1000

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
5 votes
Tags:
Medium
Points:30
34 votes
Tags:
Basic ProgrammingMediumReady
Points:30
39 votes
Tags:
ApprovedBit ManipulationData StructuresDynamic ProgrammingMediumOpenSegment Trees