Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upa number change #2
Conversation
@@ -1,10 +1,10 @@ | |||
Let f(i, j) be the number of ways of distributing j chocolates to the first i people. | |||
|
|||
Then we can give the j-th person - 0, 1, 2, ... , A[i] chocolates. | |||
Then we can give the i-th person - 0, 1, 2, ... , A[i] chocolates. |
ShreyaswadE
May 28, 2020
Author
Contributor
The i-th person can get a[i] candies. not the j-th
The i-th person can get a[i] candies. not the j-th
|
||
So, f(i, j) = f(i - 1, j ) + f(i - 1, j - 1) + ... + f(i - 1, j - A[i] - 1) | ||
|
||
If (j - A[i] - 1), then f(i, j) = f(i - 1, j) + ... + f(i - 1, 0). | ||
If (j = A[i] - 1), then f(i, j) = f(i - 1, j) + ... + f(i - 1, 0). |
ShreyaswadE
May 28, 2020
Author
Contributor
simply putting in the above formula
simply putting in the above formula
No description provided.