Oliver Eyton-Williams ee1e8abd87
feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script

* chore(curriculum): remove empty sections' markers

* chore(curriculum): add seed + solution to Chinese

* chore: remove old formatter

* fix: update getChallenges

parse translated challenges separately, without reference to the source

* chore(curriculum): add dashedName to English

* chore(curriculum): add dashedName to Chinese

* refactor: remove unused challenge property 'name'

* fix: relax dashedName requirement

* fix: stray tag

Remove stray `pre` tag from challenge file.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>

Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2021-01-12 19:31:00 -07:00

1.1 KiB
Raw Blame History

id, title, challengeType, videoUrl, dashedName
id title challengeType videoUrl dashedName
5900f36e1000cf542c50fe80 问题13和5的倍数 5 problem-1-multiples-of-3-and-5

--description--

如果我们列出所有10以下是3或5的倍数的自然数我们会得到356和9。这些倍数的总和是23。

求出所有在number以下的3或5的倍数的总和。

--hints--

multiplesOf3and5(1000)应该返回233168。

assert.strictEqual(multiplesOf3and5(1000), 233168);

multiplesOf3and5(49)应该返回543。

assert.strictEqual(multiplesOf3and5(49), 543);

multiplesOf3and5(19564)应该返回89301183。

assert.strictEqual(multiplesOf3and5(19564), 89301183);

您的函数未使用我们的测试值返回正确的结果。

assert.strictEqual(multiplesOf3and5(8456), 16687353);

--seed--

--seed-contents--

function multiplesOf3and5(number) {

  return true;
}

multiplesOf3and5(1000);

--solutions--

const multiplesOf3and5 = (number) => {
  var total = 0;

  for(var i = 0; i < number; i++) {
    if(i % 3 == 0 || i % 5 == 0) {
      total += i;
    }
  }
  return total;
};