shortest cost tiling of path to x distance
You're heading a good direction with dynamic programming, but you haven't set up the set of subproblems quite right just yet.  Don't give up on it yet.  Instead, you should keep exploring some more candidate sets of subproblems.

The art of dynamic programming lies in picking the right set of subproblems, and then identifying a suitable recurrence relation in terms of those subproblems.  Sometimes you'll have to try several possible ways of decomposing into subproblems before you find something that works, so don't give up if your first try is not a success!

Here are some hints to help you:


When one of your inputs is an array, you can try using "the set of prefixes of the array" as your set of subproblems.  In other words, if the input is an array A[0..n-1], your subproblems can be all of the prefixes A[0..j-1], where j=0,1,2,..,n-1 (this gives n subproblems).
When one of your inputs is a non-negative integer, you can try using "the set of non-negative integers no larger than the input" as your set of subproblems.  In other words, if the input is a non-negative integer m, your subproblems can be all of the integers i, where i=0,1,2,..,m.
When you have two inputs, there are some possibilities to choose a set of subproblems.  One way is to hold one of the inputs fixed and consider all subproblems for the other input.  Another way is to choose all pairs of subproblems (if $S$ is the set of subproblems for the first input, and $T$ is the set of subproblems for the second input, use $S \times T$ as your set of subproblems).


Also, you set up your dynamic programming implementation wrong.  Your goal should not be to maximize the number of price, or to maximize anything.  You are trying to minimize the total cost (so Math.max is out of place here).  Also you will need to pass in something that describes both the cost and the length of each tile; your code doesn't show anything about that.

Finally, don't write code now.  Just figure out the ideas.  Write down a recurrence relation, and try to check whether it is correct.  Then, write pseudocode and show it is correct.  Only then should you write code.  Diving straight into code is a mistake and is getting you mixed up in implementation details before you've even worked out the conceptual material.  Also, on this site, you should not be showing us code: you should be showing us algorithms and pseudocode.  This site is about algorithms, not code (StackOverflow is the place for code).

These hints should be enough to enable you to find a solution via dynamic programming (i.e., an efficient algorithm that always finds the least-cost tiling, with reasonable running time).