Supernatural Squad [2]
Practice
4 (166 votes)
Dynamic programming
Easy
Open
Recursion
Two dimensional
Problem
73% Success 4163 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Fatal Eagle has decided to do something to save his favorite city against the attack of Mr. XYZ, since no one else surprisingly seems bothered about it, and are just suffering through various attacks by various different creatures.

Seeing Fatal Eagle's passion, N members of the Bangalore City decided to come forward to try their best in saving their city. Now Fatal Eagle decided to strategize these N people into a formation of AT LEAST K people in a group. Otherwise, that group won't survive.

Let's demonstrate this by an example. Let's say that there were 10 people, and each group required at least 3 people in it for its survival. Then, the following 5 groups can be made:

  • 10 - Single group of 10 members.
  • 7, 3 - Two groups. One consists of 7 members, the other one of 3 members.
  • 6, 4 - Two groups. One consists of 6 members, the other one of 4 members.
  • 5, 5 - Two groups. One consists of 5 members, the other one of 5 members.
  • 4, 3, 3 - Three groups. One consists of 4 members, the other two of 3 members.

Given the value of N, and K - help Fatal Eagle in finding out the number of ways he can form these groups (anti-squads) to save his city.

Input format:
The first line would contain, T - denoting the number of test cases, followed by two integers, N and K denoting the number of people who're willing to help and size of the smallest possible group which can be formed.

Output format:
You've to print the number of ways in which groups can be formed.

Constraints:
1 <= T <= 30
1 <= N, K <= 200

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
30 votes
Tags:
AlgorithmsDynamic ProgrammingEasyTwo dimensional簡単-普通
Points:30
26 votes
Tags:
AlgorithmsDynamic Programming2D dynamic programmingMathPrime Factorization
Points:30
11 votes
Tags:
2-D ArrayAlgorithmsDynamic ProgrammingEasy