多项式集

发布于 2024-10-19 21:23:03 字数 565 浏览 5 评论 0原文

我在解决这个问题时遇到问题,它类似于组合非唯一字母集,但略有不同。

令k、m和n为正整数。我们有 nm 个球、m 个颜色、n 个球和 k 个独特标记的箱子。有多少种不同的方法来选择n个球放入k个袋子中?

例如,如果 m = 3、n = k = 2,则结果为 21。有 3 种颜色,我们从总共 6 个球中选择 2 个球放入 2 个箱子中。

(-,WW),(-,WR),(-,WB)...

(WW,-),(WR,-)...

(宽,宽),(宽,右)...

(B,W),(B,R) ...

这个问题的正常版本不需要选择总元素的子集。该问题产生 n! /x1! x<子>2! x<子>3! ...其中 x1、x2、x3 是重复字母组。

校正(清晰度)->你总共有 nm 个球。每种颜色有 n 个球,其中有 m 种颜色;然后,从这里随机选择总共 nm 个球中的 n 个,并将它们放入 k 个不同的箱子中。

I'm having a problem figuring out this problem, it is similar to combining sets of non-unique letters, but is slightly different.

Let k, m, and n be positive integers. We have nm balls, m colors, n balls, and k uniquely labeled bins. How many different ways are there to select n balls to put into the k bags?

For example, if m = 3, n = k = 2, the result is 21. There are 3 colors where we are choosing 2 balls out of the total 6 to place into 2 bins.

(-, WW), (-,WR), (-, WB) ...

(WW, -), (WR, -) ...

(W,W), (W,R) ...

(B,W), (B,R) ...

The normal version of this problem does not require the selection of a subset of the total elements. That problem yields n! / x1! x2! x3! ... where x1, x2, x3 are groups of duplicated letters.

correction (clarity) -> you have a total of nm balls. n balls of each color where there are m colors; from here you then choose n of these total nm balls randomly and place them into the k distinct bins.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

玩心态 2024-10-26 21:23:03

让我确定我的问题是正确的。我们有 m 种颜色。我们有 k 个垃圾箱。我们想要选择 n 个球并将它们放入箱子中。我们有足够的每种颜色的球,我们不必担心任何特定颜色的球用完。

在这种情况下,问题归结为我们有多少种 nm*k 种球。 (一种由颜色和容器决定。)有一个标准技巧来计算它。首先让我们对种类进行编号。放下所有第一种球。然后是分隔器。然后是所有第二种球。然后是分隔器。依此类推,直到我们拥有所有 n 个球和 k*m - 1 分隔线。这个过程是完全可逆的,如果我们将 n + k*m - 1 个东西排成一行,选择其中的 n 个作为球,其余的作为分隔物,我们然后可以给球着色并将它们放入箱子中,以在 k 个箱子中获得 nm 种颜色的球。

因此答案是选择(n + k*m - 1, n)

(请注意,这是我在知道答案后得出的推理。我的实际答案路径更长且更迂回。)

Let me be sure I have the question right. We have m colors. We have k bins. We want to select n balls and place them in the bins. We have enough balls of each color that we don't have to worry about running out of any particular color.

In that case, the problem boils down to how many ways we have have n balls of m*k kinds. (A kind being determined by color and bin.) There is a standard trick to calculate this. First let's number the kinds. Put down all of the balls of the first kind. Then a divider. Then all the balls of the second kind. Then a divider. And so on until we have all n balls and k*m - 1 dividers down. This procedure is completely reversible, if we take n + k*m - 1 things in a row, select n of them to be balls and the rest to be dividers, we can then color the balls and put them into bins to get to n balls of m colors in k bins.

Therefore the answer is choose(n + k*m - 1, n).

(Note, this is the reasoning that I came up with after I knew the answer. My actual path to the answer was much longer and more circuitous.)

梦太阳 2024-10-26 21:23:03

我相信你可以把这个问题看成m个独立的n-多重组合。

所以答案是 m * multichoose(n, k),其中 multichoose(a, b) = C(a + b -1, b)。


编辑:这假设您询问每种颜色的 n 个球并放置所有 nm 个球。

I believe that you can treat this problem as m independent n-multicombinations.

So the answer is m * multichoose(n, k), where multichoose(a, b) = C(a + b -1, b).


Edit: This assumes you are asking about n balls of each color and placing all nm balls.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文