Guest User

Untitled

a guest
Jan 13th, 2012
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. memset(memo, 0, sizeof memo);
  2. memo[0][0][0] = 1;
  3.  
  4. for (int p = 0; p < TOTAL_PEOPLE; ++p)
  5. {
  6.     for (int w = 0; w <= MAX_WEIGHT; ++w)
  7.     {
  8.         for (int u = 0; u < MAX_USED; ++u)
  9.         {
  10.             if (memo[w][p][u] == 1)
  11.             {
  12.                 memo[w][p+1][u] = 1;
  13.                 memo[w+person[p]][p+1][u+1] = 1;
  14.             }
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment