MathsReadCompetitive mathematics
Algorithmic puzzle · integer answereasy25 min

Exactly seven triple-jumps

Dynamic Programming

How many ordered sequences of steps from {1,3,4} sum to 38, if exactly seven of the steps must be 3? Different orders count separately.

Solve using mathematics, algorithms, or your own code offline. Submit only the final integer here—no program, expression, graph, or written proof.

Check your answer without signing in. Sign in to save your progress.

Accepted format: a whole number such as 42 or 123456789. No commas, formulas, or source code.

How to approach this problem

Track the remaining distance and number of special steps used. Each transition appends one step, so different orders contribute separately. Reject states exceeding the special-step quota.

Worked example with different values

To total 5 using steps 1 and 3 with exactly one 3, the sequences are 3,1,1; 1,3,1; and 1,1,3.

Apply the same reasoning to the challenge. This example is a separate practice problem.

Learn the technique: Dynamic programming and grid paths

Report a question or explanation issue

Back to problems →