Skip to content

Commit

Permalink
Update cses-1716.mdx
Browse files Browse the repository at this point in the history
changed n to m and m to n
  • Loading branch information
MdShihabAhmed authored Nov 7, 2024
1 parent 472d788 commit 3f72873
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions solutions/gold/cses-1716.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ to count how many ways you can put the children between the apples.
## Explanation

To get a more illustrative idea of the given problem, consider $n + m - 1$ white
balls in a row. Of those $n + m - 1$ white balls, $m - 1$ are chosen to be
colored black as separators, which gives us exactly $m$ segments of (possibly
balls in a row. Of those $n + m - 1$ white balls, $n - 1$ are chosen to be
colored black as separators, which gives us exactly $n$ segments of (possibly
zero) white balls. There are

$$
\binom{n + m - 1}{m - 1}
\binom{n + m - 1}{n - 1}
$$

ways to choose the balls to color black.

The ways to color $m - 1$ balls black corresponds to the ways to distribute
those $n$ apples to $m$ children, since the number of white balls in a segment
The ways to color $n - 1$ balls black corresponds to the ways to distribute
those $m$ apples to $n$ children, since the number of white balls in a segment
corresponds to the number of apples given to a child.

<Info title="Stars and bars">
Expand Down

0 comments on commit 3f72873

Please sign in to comment.