Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- memset(memo, 0, sizeof memo);
- memo[0][0][0] = 1;
- for (int p = 0; p < TOTAL_PEOPLE; ++p)
- {
- for (int w = 0; w <= MAX_WEIGHT; ++w)
- {
- for (int u = 0; u < MAX_USED; ++u)
- {
- if (memo[w][p][u] == 1)
- {
- memo[w][p+1][u] = 1;
- memo[w+person[p]][p+1][u+1] = 1;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment