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
Submissions
Please login to view your submissions
Similar Problems
Points:50
1 votes
Tags:
AlgorithmsApprovedGraphsHardKuhn munkres algorithmOpen
Points:30
Tags:
Medium
Points:20
685 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyHash MapsHiringOpen
Editorial