Count the permutation
Practice
4 (8 votes)
Algorithms
Approved
Dynamic programming
Easy
Grammar Verified
Recruit
Two dimensional
Problem
79% Success 4759 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given two numbers, namely A and S.

Write a program to find the number of ways in which the numbers that are greater than or equal to S can be added to get the sum A. Print the result as modulo \(10^9 + 9\).

Input format

  • First line: T (Number of test cases)
  • First line in each test case: Two space-separated integers A and S

Output format

For each test case, print the number of ways to acquire the sum A using the numbers that are greater than or equal to S.

Constraints

1 ≤ T ≤ 1000
1 ≤ A , S ≤ 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
166 votes
Tags:
Dynamic ProgrammingEasyOpenRecursionTwo dimensional
Points:30
27 votes
Tags:
AlgorithmsDynamic Programming2D dynamic programmingC++
Points:30
13 votes
Tags:
Dynamic ProgrammingEasyTwo dimensional