The Wayback Machine - https://web.archive.org/web/20201026125816/https://github.com/MathProgrammer/AtCoder/pull/2
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a number change #2

Merged
merged 2 commits into from Jun 27, 2020
Merged

a number change #2

merged 2 commits into from Jun 27, 2020

Conversation

@ShreyaswadE
Copy link
Contributor

@ShreyaswadE ShreyaswadE commented May 28, 2020

No description provided.

ShreyaswadE added 2 commits May 28, 2020
@@ -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.

This comment has been minimized.

@ShreyaswadE

ShreyaswadE May 28, 2020
Author Contributor

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).

This comment has been minimized.

@ShreyaswadE

ShreyaswadE May 28, 2020
Author Contributor

simply putting in the above formula

@MathProgrammer MathProgrammer merged commit ef99d2a into MathProgrammer:master Jun 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.