Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. for (int j = 0; j <= maxCount; j++) {
  2. int max_ = 0;
  3. for (int all = 1; all < j; all++) {
  4. int m = memory[l_ix][all] + memory[r_ix][j - all];
  5. if (m > max_) max_ = m;
  6. }
  7. if (j == maxCount) {
  8. max_ = max(max_, memory[l_ix][j - 1]);
  9. max_ = max(max_, memory[r_ix][j - 1]);
  10. }
  11. memory[i][j] = max_ + tree[i];
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement