freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-103-special-subset-...

39 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
id: 5900f3d61000cf542c50fee7
title: 问题103特殊子集和最佳
challengeType: 5
videoUrl: ''
dashedName: problem-103-special-subset-sums-optimum
---
# --description--
设SA表示大小为n的集合A中的元素之和。如果对于任何两个非空的不相交子集B和C我们将其称为特殊和集合以下属性为真SB≠SC;也就是说子集的总和不能相等。如果B包含的元素多于C则SB> SC。如果对于给定的nSA被最小化我们将其称为最优的特殊和集。下面给出前五个最佳特殊和集。 n = 1{1} n = 2{1,2} n = 3{2,3,4} n = 4{3,5,6,7} n = 5{6,9,11 12,13}似乎对于给定的最优集合A = {a1a2...an}下一个最优集合的形式为B = {ba1 + ba2 + b... ..an + b}其中b是前一行的“中间”元素。通过应用这个“规则”我们期望n = 6的最优集合为A = {11,17,20,22,23,24}其中SA= 117.但是,这不是最佳集合因为我们仅应用算法来提供接近最优的集合。 n = 6的最佳集合是A = {11,18,19,20,22,25}其中SA= 115并且对应的集合字符串111819202225。假设A是n =的最优特殊和集合7找到它的设置字符串。注意此问题与问题105和问题106有关。
# --hints--
`euler103()`应该返回20313839404245。
```js
assert.strictEqual(euler103(), 20313839404245);
```
# --seed--
## --seed-contents--
```js
function euler103() {
return true;
}
euler103();
```
# --solutions--
```js
// solution required
```