Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cost[m_, n_] := 0 /; m >= n;
- cost[m_, n_] := cost[m, n] =
- Min@Table[l + (l - m) cost[m, l - 1]/(n - m + 1)
- + (n - l) cost[l + 1, n]/(n - m + 1), {l, m, n}]
- cost[1, 100]
- Table[cost[1, i], {i, 1, 10}]*Range[10]
Add Comment
Please, Sign In to add comment