Shil and weird equation (Optional)
Practice
3.9 (134 votes)
Medium
Problem
37% Success 75 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Shil came across a weird equation and he wants to find out total number of solutions of this equation.The weird equation is :
x1+ x2 + x3 ... xN = D .
Find total number of solutions of this equation such that each xi are non-negative and gcd of all the xi is one.Here gcd stands for greatest common divisor.
Assume that gcd(0,y) = y for any y.
Input:
Only line of input consists of two integers N and D .
Output:
Output total number of solutions modulus 109+7
Constraint:
1 ≤ N ≤ 104
1 ≤ D ≤ 104
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
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
11 votes
Tags:
AlgorithmsDynamic ProgrammingEasyTwo dimensional
2.Hard job
Points:50
40 votes
Tags:
ApprovedData StructuresFenwick TreeHardOpenSegment TreesTrees
Points:20
11 votes
Tags:
Easy
Editorial
Login to unlock the editorial