我遇到了以下问题:
Let N be a set of natural numbers with length n.
Let S be the set of all cumulative sums, where a cumulative sum is the sum of the first k elements of a set.
Now, given N, permutate its elements, so that S_i contains no element of S (i refers to the ith permutation).
Find as many of these permutations, as possible.
谁能帮我出出主意?您不必提供算法,只需提供方法。
最佳答案
显然,S_i
(或S
)中的最后一个元素是所有元素的总和。无论您如何排列元素,该元素始终位于列表中(顺便说一句,如果您引用一个顺序,调用 N
或 S
集合在语法上是错误的)。
因此,N
不存在 S_i
与 S
不相交的排列。
关于algorithm - 找到完全改变累积和集的排列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48560919/