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
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3408 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 155 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 145 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | BledDest | 136 |
| 8 | adamant | 135 |
| 9 | maroonrk | 133 |
| 10 | cry | 130 |
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
| Name |
|---|



Answer is
. We arrange
gates and
candies in a row and choose
elements to be gates.
Hello Sir, Shouldn't it be (n+r-1, r-1).
Yes,in gotop's problem,it should be But adamant have already assumed that there are r candies,n people So both of you are right
second theorem described here can be helpful
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)