Jumping stones
Practice
2.9 (30 votes)
Algorithms
Dynamic programming
Problem
88% Success 8310 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
There are \(n\) stones in a row from left to right. You are standing on the first stone. From every stepĀ from stone number \(i\), you can jump at most \(k\) stones further (\(i + 1,\ i + 2,\ \dots,\ i + k\)). You cannot jump over stone number \(n\). How many ways are there to travel to stone number \(n\)?
Input format
First line: \(n\) and \(k\)
Output format
Print the answer modulo \(10^9+7\).
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
38 votes
Tags:
ApprovedDynamic ProgrammingEasyImplementationOpen
Points:20
32 votes
Tags:
EasyMathOpen
Points:20
703 votes
Tags:
ApprovedData StructuresDynamic ProgrammingEasyNumber TheoryReady
Editorial
Login to unlock the editorial