gotop's blog

By gotop, history, 9 years ago, In English

If we can give zero candy to person, is there any way to compute Fast "distribute n candies to r people" ??

if we can't give zero candy, solution is (n-1)C(r-1)

but we can give zero candy, I don't know how to compute fast

please help me

  • Vote: I like it
  • -5
  • Vote: I do not like it

»
9 years ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

Answer is . We arrange gates and candies in a row and choose elements to be gates.

»
9 years ago, hide # |
← Rev. 6  
Vote: I like it +4 Vote: I do not like it

second theorem described here can be helpful

»
9 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Give one more candy to each person. So the solutions equals to "distribute n+r-1 candies to r people(we can't give zero candy)" or (n+r-1)C(r-1)