Files
freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/rosetta-code/9-billion-names-of-god-the-integer.chinese.md
Kristofer Koishigawa b3213fc892 fix(i18n): chinese test suite (#38220)
* fix: Chinese test suite

Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working.

* fix: ran script, updated testStrings and solutions
2020-03-03 18:49:47 +05:30

2.7 KiB
Raw Blame History

title, id, challengeType, videoUrl, localeTitle
title id challengeType videoUrl localeTitle
9 billion names of God the integer 5949b579404977fbaefcd736 5 90亿上帝的名字整数

Description

这项任务是Arthur C. Clarke短篇小说改编

(求解者应该意识到完成这项任务的后果。)

详细说明,指定“名称”的含义:

整数1有1个名称“1”。

整数2有2个名称“1 + 1”和“2”。

整数3具有3个名称“1 + 1 + 1”“2 + 1”和“3”。

整数4具有5个名称“1 + 1 + 1 + 1”“2 + 1 + 1”“2 + 2”“3 + 1”“4”。

整数5有7个名称“1 + 1 + 1 + 1 + 1”“2 + 1 + 1 + 1”“2 + 2 + 1”“3 + 1 + 1”“3 + 2” “4 + 1”“5”。

这可以通过以下形式显示:

 1
        1 1
      1 1 1
    1 2 1 1
  1 2 2 1 1
1 3 3 2 1 1

其中row $ n $对应于整数$ n $,而行$ m $中从左到右的每列$ C $对应于以$ C $开头的名称数。

(可选)请注意$ n $ -th行$ Pn$的总和是整数分区函数

任务

实现一个返回$ n $ -th行之和的函数。

Instructions

Tests

tests:
  - text: <code>numberOfNames</code>是一个函数。
    testString: assert(typeof numberOfNames === 'function');
  - text: <code>numberOfNames(5)</code>应该等于7。
    testString: assert.equal(numberOfNames(5), 7);
  - text: <code>numberOfNames(12)</code>应该等于77。
    testString: assert.equal(numberOfNames(12), 77);
  - text: <code>numberOfNames(18)</code>应该等于385。
    testString: assert.equal(numberOfNames(18), 385);
  - text: <code>numberOfNames(23)</code>应该等于1255。
    testString: assert.equal(numberOfNames(23), 1255);
  - text: <code>numberOfNames(42)</code>应该等于53174。
    testString: assert.equal(numberOfNames(42), 53174);
  - text: <code>numberOfNames(123)</code>应该等于2552338241。
    testString: assert.equal(numberOfNames(123), 2552338241);

Challenge Seed

function numberOfNames (num) {
  // Good luck!
  return true;
}

Solution

// solution required