Bino-Sum
Practice
3.7 (21 votes)
Approved
Combinatorics
Dynamic programming
Easy
Math
Open
Problem
22% Success 10229 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Let us define \(F(N,K)\) be number of subsets of K distinct elements of S where N is the size of S. Given a \(P( ≤ N)\), let \(Sum = F(N,0) + F(N,1) + ... + F(N,P)\).
You have to print Sum modulo \(1000000007\).

Input:
First line contains, T, the number of testcases. Each testcase consists of N and P in one line.

Output:
Print required answer in one line for each testcase.

**Constraints:
\(1 ≤ T ≤ 1000\)
\(1 ≤ N ≤ 1000\)
\(0 ≤ P ≤ N\)

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:20
3 votes
Tags:
AlgorithmsDynamic ProgrammingEasyTwo dimensional
Points:20
27 votes
Tags:
AlgorithmsApprovedDynamic ProgrammingEasyOpenTwo dimensional
Points:20
19 votes
Tags:
AlgorithmsApprovedDynamic ProgrammingEasyOpen