chore(i18n,curriculum): update translations (#43633)
This commit is contained in:
@@ -11,9 +11,9 @@ dashedName: use-hex-code-for-specific-colors
|
||||
|
||||
你知道在 CSS 裏面還有其他方式來代表顏色嗎? 其中一個方法叫十六進制編碼,簡稱 hex。
|
||||
|
||||
日常生活中,我們使用的計數方法一般是 <dfn>decimals</dfn>,或十進制,即使用數字 0 到 9 來表示。 而 <dfn>Hexadecimals</dfn>(或 <dfn>hex</dfn>)基於 16 位數字, 它包括 16 種不同字符。 像十進制一樣,0-9 的符號代表 0 到 9 的值。 然後,A、B、C、D、E、F 代表 10 至 15 的值。 總的來說,0 到 F 在十六進制裏代表數字,總共有 16 個值。 你可以在這裏訪問更多[關於十六進制的信息](https://en.wikipedia.org/wiki/Hexadecimal)。
|
||||
日常生活中,我們使用的計數方法一般是 <dfn>decimals</dfn>,或十進制,即使用數字 0 到 9 來表示。 而 <dfn>Hexadecimals</dfn>(或 <dfn>hex</dfn>)基於 16 位數字, 它包括 16 種不同字符。 像十進制一樣,0-9 的符號代表 0 到 9 的值。 然後,A、B、C、D、E、F 代表 10 至 15 的值。 總的來說,0 到 F 在十六進制裏代表數字,總共有 16 個值。 你可以在[此處](https://www.freecodecamp.org/news/hexadecimal-number-system/)找到更多關於十六進制信息。
|
||||
|
||||
在 CSS 裏面,我們可以使用 6 個十六進制的數字來代表顏色,每兩個數字控制一種顏色,分別是紅(R)、綠(G)、藍(B)。 例如,`#000000` 代表黑色,同時也是最小的值。 你可以在 [RGB color system here](https://en.wikipedia.org/wiki/RGB_color_model) 找到更多的相關信息。
|
||||
在 CSS 裏面,我們可以使用 6 個十六進制的數字來代表顏色,每兩個數字控制一種顏色,分別是紅(R)、綠(G)、藍(B)。 例如,`#000000` 代表黑色,同時也是最小的值。 你可以在[此處](https://www.freecodecamp.org/news/rgb-color-html-and-css-guide/#whatisthergbcolormodel)找到更多關於 RGB 顏色系統的信息。
|
||||
|
||||
```css
|
||||
body {
|
||||
|
@@ -37,7 +37,7 @@ dashedName: add-images-to-your-website
|
||||
|
||||
在 `main` 元素裏,給 `p` 元素前面插入一個 `img` 元素。
|
||||
|
||||
現在設置 `src` 屬性,使它指向網址 `https://www.bit.ly/fcc-relaxing-cat`。
|
||||
現在設置 `src` 屬性,使其指向 url `https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg`
|
||||
|
||||
最後,不要忘記給 `img` 加上 `alt` 屬性。
|
||||
|
||||
@@ -52,7 +52,7 @@ assert($('img').length);
|
||||
你的圖片應該有一個 `src` 屬性,其值爲貓咪圖片的 url。
|
||||
|
||||
```js
|
||||
assert(/^https:\/\/(www\.)?bit\.ly\/fcc-relaxing-cat$/i.test($('img').attr('src')));
|
||||
assert(/^https:\/\/cdn\.freecodecamp\.org\/curriculum\/cat-photo-app\/relaxing-cat\.jpg$/i.test($('img').attr('src')));
|
||||
```
|
||||
|
||||
你的圖片元素的 `alt` 屬性值不應爲空。
|
||||
@@ -86,7 +86,7 @@ assert(
|
||||
```html
|
||||
<h2>CatPhotoApp</h2>
|
||||
<main>
|
||||
<a href="#"><img src="https://www.bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
<a href="#"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
|
||||
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
|
||||
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
|
||||
</main>
|
||||
|
@@ -29,7 +29,7 @@ var ourMusic = [
|
||||
];
|
||||
```
|
||||
|
||||
這是一個包含一個對象的數組。 該對象有關於專輯的各種元數據(<dfn>metadata</dfn>)。 它也有一個嵌套的 `formats` 數組。 可以將專輯添加到頂級數組來增加更多的專輯記錄。 對象將數據以一種鍵 - 值對的形式保存。 在上面的示例中,`"artist": "Daft Punk"` 有一個鍵位 `artist` 值爲 `Daft Punk` 的屬性。 [JavaScript Object Notation](http://www.json.org/) 簡稱 `JSON` 是可以用於存儲數據的數據交換格式。
|
||||
這是一個包含一個對象的數組。 該對象有關於專輯的各種元數據(<dfn>metadata</dfn>)。 它也有一個嵌套的 `formats` 數組。 可以將專輯添加到頂級數組來增加更多的專輯記錄。 對象將數據以一種鍵 - 值對的形式保存。 在上面的示例中,`"artist": "Daft Punk"` 有一個鍵爲 `artist` 值爲 `Daft Punk` 的屬性。 [JavaScript Object Notation](http://www.json.org/) 簡稱 `JSON` 是可以用於存儲數據的數據交換格式。
|
||||
|
||||
```json
|
||||
{
|
||||
|
@@ -42,10 +42,10 @@ assert.deepEqual(addTogether(23, 30), 53);
|
||||
assert.deepEqual(addTogether(5)(7), 12);
|
||||
```
|
||||
|
||||
`addTogether("http://bit.ly/IqT6zt")` 應返回 `undefined`。
|
||||
`addTogether("https://www.youtube.com/watch?v=dQw4w9WgXcQ")` 應該返回 `undefined`。
|
||||
|
||||
```js
|
||||
assert.isUndefined(addTogether('http://bit.ly/IqT6zt'));
|
||||
assert.isUndefined(addTogether('https://www.youtube.com/watch?v=dQw4w9WgXcQ'));
|
||||
```
|
||||
|
||||
`addTogether(2, "3")` 應返回 `undefined`。
|
||||
|
@@ -8,7 +8,7 @@ dashedName: make-images-mobile-responsive
|
||||
|
||||
# --description--
|
||||
|
||||
首先,在已有的圖片下面添加一張新的圖片。 設置其 `src` 屬性爲 `https://bit.ly/fcc-running-cats`。
|
||||
首先,在已有的圖片下面添加一張新的圖片。 將新圖片的 `src` 屬性設置爲 `https://cdn.freecodecamp.org/curriculum/cat-photo-app/running-cats.jpg`。
|
||||
|
||||
如果圖片的大小恰恰和我們手機屏幕尺寸大小一樣自然是最好的。
|
||||
|
||||
@@ -34,10 +34,10 @@ assert($('img:eq(1)').hasClass('img-responsive'));
|
||||
assert(!$('img:eq(1)').hasClass('smaller-image'));
|
||||
```
|
||||
|
||||
新圖片的 `src` 屬性值應該爲 `https://bit.ly/fcc-running-cats`。
|
||||
新圖片應該有一個值爲 `https://cdn.freecodecamp.org/curriculum/cat-photo-app/running-cats.jpg` 的 `src` 屬性。
|
||||
|
||||
```js
|
||||
assert($('img:eq(1)').attr('src') === 'https://bit.ly/fcc-running-cats');
|
||||
assert($('img:eq(1)').attr('src') === 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/running-cats.jpg');
|
||||
```
|
||||
|
||||
確保新的 `img` 元素有一個閉合的尖括號。
|
||||
@@ -87,7 +87,7 @@ assert(
|
||||
|
||||
<p>Click here for <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
<a href="#"><img class="smaller-image thick-green-border" src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
|
||||
|
||||
<p>Things cats love:</p>
|
||||
<ul>
|
||||
@@ -148,8 +148,8 @@ assert(
|
||||
|
||||
<p>Click here for <a href="#">cat photos</a>.</p>
|
||||
|
||||
<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
|
||||
<img src="https://bit.ly/fcc-running-cats" class="img-responsive">
|
||||
<a href="#"><img class="smaller-image thick-green-border" src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
|
||||
<img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/running-cats.jpg" class="img-responsive">
|
||||
|
||||
<p>Things cats love:</p>
|
||||
<ul>
|
||||
|
@@ -35,40 +35,66 @@ app.route('/login')
|
||||
|
||||
# --hints--
|
||||
|
||||
路由 /auth/github 應正確配置。
|
||||
路由 `/auth/github` 應該是正確的。
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
$.get(getUserInput('url') + '/_api/routes.js').then(
|
||||
(data) => {
|
||||
async (getUserInput) => {
|
||||
try {
|
||||
const res = await fetch(getUserInput('url') + '/_api/routes.js');
|
||||
if (res.ok) {
|
||||
const data = await res.text();
|
||||
assert.match(
|
||||
data.replace(/\s/g, ''),
|
||||
/('|")\/auth\/github\/?\1[^]*?get.*?passport.authenticate.*?github/gi,
|
||||
'Route auth/github should only call passport.authenticate with github'
|
||||
);
|
||||
},
|
||||
(xhr) => {
|
||||
throw new Error(xhr.statusText);
|
||||
data.replace(/\s/g, ''),
|
||||
/passport.authenticate.*?github/g,
|
||||
'Route auth/github should only call passport.authenticate with github'
|
||||
);
|
||||
} else {
|
||||
throw new Error(res.statusText);
|
||||
}
|
||||
);
|
||||
const res2 = await fetch(getUserInput('url') + '/_api/app-stack');
|
||||
if (res2.ok) {
|
||||
const data2 = JSON.parse(await res2.json());
|
||||
const dataLayer = data2.find(layer => layer?.route?.path === '/auth/github');
|
||||
assert.deepInclude(dataLayer?.route, { methods: {get: true}, path: "/auth/github"});
|
||||
assert.deepInclude(dataLayer?.route?.stack?.[0], {method: "get", name: "authenticate"});
|
||||
} else {
|
||||
throw new Error(res2.statusText);
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
路由 /auth/github/callback 應正確配置。
|
||||
路由 `/auth/github/callback` 應該是正確的。
|
||||
|
||||
```js
|
||||
(getUserInput) =>
|
||||
$.get(getUserInput('url') + '/_api/routes.js').then(
|
||||
(data) => {
|
||||
async (getUserInput) => {
|
||||
try {
|
||||
const res = await fetch(getUserInput('url') + '/_api/routes.js');
|
||||
if (res.ok) {
|
||||
const data = await res.text();
|
||||
assert.match(
|
||||
data.replace(/\s/g, ''),
|
||||
/('|")\/auth\/github\/callback\/?\1[^]*?get.*?passport.authenticate.*?github.*?failureRedirect:("|')\/\2/gi,
|
||||
/failureRedirect:("|')\/\1/g,
|
||||
'Route auth/github/callback should accept a get request and call passport.authenticate for github with a failure redirect to home'
|
||||
);
|
||||
},
|
||||
(xhr) => {
|
||||
throw new Error(xhr.statusText);
|
||||
} else {
|
||||
throw new Error(res.statusText);
|
||||
}
|
||||
);
|
||||
const res2 = await fetch(getUserInput('url') + '/_api/app-stack');
|
||||
if (res2.ok) {
|
||||
const data2 = JSON.parse(await res2.json());
|
||||
const dataLayer = data2.find(layer => layer?.route?.path === '/auth/github/callback');
|
||||
assert.deepInclude(dataLayer?.route, { methods: {get: true}, path: "/auth/github/callback"});
|
||||
assert.deepInclude(dataLayer?.route?.stack?.[0], {method: "get", name: "authenticate"});
|
||||
} else {
|
||||
throw new Error(res2.statusText);
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3c81000cf542c50fedb
|
||||
title: 'Problem 92: Square digit chains'
|
||||
title: '問題 92:平方數鏈'
|
||||
challengeType: 5
|
||||
forumTopicId: 302209
|
||||
dashedName: problem-92-square-digit-chains
|
||||
@@ -8,43 +8,43 @@ dashedName: problem-92-square-digit-chains
|
||||
|
||||
# --description--
|
||||
|
||||
A number chain is created by continuously adding the square of the digits in a number to form a new number until it has been seen before.
|
||||
將一個數字的每一位求平方再相加可以得到一個新的數字,不斷重複該過程,直到新的數字出現過爲止,可以得到一條數鏈。
|
||||
|
||||
For example,
|
||||
舉個例子:
|
||||
|
||||
$$\begin{align} & 44 → 32 → 13 → 10 → \boldsymbol{1} → \boldsymbol{1}\\\\ & 85 → \boldsymbol{89} → 145 → 42 → 20 → 4 → 16 → 37 → 58 → \boldsymbol{89}\\\\ \end{align}$$
|
||||
|
||||
Therefore any chain that arrives at 1 or 89 will become stuck in an endless loop. What is most amazing is that EVERY starting number will eventually arrive at 1 or 89.
|
||||
可以發現,每條到達 1 或 89 的數鏈都會陷入循環。 最令人驚訝的是,從任意數字開始,數鏈最終都會到達 1 或 89。
|
||||
|
||||
How many starting numbers below `limit` will arrive at 89?
|
||||
求出有多少個小於 `limit` 的數字最終會到達 89?
|
||||
|
||||
# --hints--
|
||||
|
||||
`squareDigitChains(100)` should return a number.
|
||||
`squareDigitChains(100)` 應該返回一個數字。
|
||||
|
||||
```js
|
||||
assert(typeof squareDigitChains(100) === 'number');
|
||||
```
|
||||
|
||||
`squareDigitChains(100)` should return `80`.
|
||||
`squareDigitChains(100)` 應該返回 `80`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(squareDigitChains(100), 80);
|
||||
```
|
||||
|
||||
`squareDigitChains(1000)` should return `857`.
|
||||
`squareDigitChains(1000)` 應該返回 `857`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(squareDigitChains(1000), 857);
|
||||
```
|
||||
|
||||
`squareDigitChains(100000)` should return `85623`.
|
||||
`squareDigitChains(100000)` 應該返回 `85623`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(squareDigitChains(100000), 85623);
|
||||
```
|
||||
|
||||
`squareDigitChains(10000000)` should return `8581146`.
|
||||
`squareDigitChains(10000000)` 應該返回 `8581146`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(squareDigitChains(10000000), 8581146);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3cc1000cf542c50fede
|
||||
title: 'Problem 95: Amicable chains'
|
||||
title: '問題 95:友好的數鏈'
|
||||
challengeType: 5
|
||||
forumTopicId: 302212
|
||||
dashedName: problem-95-amicable-chains
|
||||
@@ -8,45 +8,45 @@ dashedName: problem-95-amicable-chains
|
||||
|
||||
# --description--
|
||||
|
||||
The proper divisors of a number are all the divisors excluding the number itself. For example, the proper divisors of 28 are 1, 2, 4, 7, and 14. As the sum of these divisors is equal to 28, we call it a perfect number.
|
||||
一個數的真因子是除自身以外的其他因子。 例如,28 的真因子是 1、2、4、7 和 14。 由於這些真因子之和等於 28,我們稱 28 爲完全數,又稱完美數或完備數。
|
||||
|
||||
Interestingly the sum of the proper divisors of 220 is 284 and the sum of the proper divisors of 284 is 220, forming a chain of two numbers. For this reason, 220 and 284 are called an amicable pair.
|
||||
有趣的是,220 的真因子之和爲 284,而 284 的真因子之和爲 220,形成了一條兩個數構成的鏈。 因此,220 和 284 被稱爲友好數對。
|
||||
|
||||
Perhaps less well known are longer chains. For example, starting with 12496, we form a chain of five numbers:
|
||||
也許更長的鏈條鮮爲人知。 例如,從 12496 開始,可以形成一條五個數字的數鏈:
|
||||
|
||||
$$ 12496 → 14288 → 15472 → 14536 → 14264 \\,(→ 12496 → \cdots) $$
|
||||
|
||||
Since this chain returns to its starting point, it is called an amicable chain.
|
||||
由於該鏈返回其起始點,因此稱爲友好數鏈。
|
||||
|
||||
Find the smallest member of the longest amicable chain with no element exceeding `limit`.
|
||||
找出最長友好數鏈中的最小數字,要求該鏈中的每一個數字均不能超過給定的 `limit`。
|
||||
|
||||
# --hints--
|
||||
|
||||
`amicableChains(300)` should return a number.
|
||||
`amicableChains(300)` 應該返回一個數字。
|
||||
|
||||
```js
|
||||
assert(typeof amicableChains(300) === 'number');
|
||||
```
|
||||
|
||||
`amicableChains(300)` should return `220`.
|
||||
`amicableChains(300)` 應該返回 `220`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(amicableChains(300), 220);
|
||||
```
|
||||
|
||||
`amicableChains(15000)` should return `220`.
|
||||
`amicableChains(15000)` 應該返回 `220`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(amicableChains(15000), 220);
|
||||
```
|
||||
|
||||
`amicableChains(100000)` should return `12496`.
|
||||
`amicableChains(100000)` 應該返回 `12496`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(amicableChains(100000), 12496);
|
||||
```
|
||||
|
||||
`amicableChains(1000000)` should return `14316`.
|
||||
`amicableChains(1000000)` 應該返回 `14316`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(amicableChains(1000000), 14316);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3cc1000cf542c50fedf
|
||||
title: 'Problem 96: Su Doku'
|
||||
title: '問題 96:數獨'
|
||||
challengeType: 5
|
||||
forumTopicId: 302213
|
||||
dashedName: problem-96-su-doku
|
||||
@@ -8,7 +8,7 @@ dashedName: problem-96-su-doku
|
||||
|
||||
# --description--
|
||||
|
||||
Su Doku (Japanese meaning *number place*) is the name given to a popular puzzle concept. Its origin is unclear, but credit must be attributed to Leonhard Euler who invented a similar, and much more difficult, puzzle idea called Latin Squares. The objective of Su Doku puzzles, however, is to replace the blanks (or zeros) in a 9 by 9 grid in such that each row, column, and 3 by 3 box contains each of the digits 1 to 9. Below is an example of a typical starting puzzle grid and its solution grid.
|
||||
數獨(日語含義爲*數字位置*)是一個非常流行的解密遊戲。 它的起源尚不清楚,但必須歸功於萊昂哈德·歐拉(Leonhard Euler),他發明了一種類似的,但更加困難的解密遊戲,名叫拉丁方塊(Latin Squares)。 數獨的目標是用數字替換 9X9 網格中的空白(或零),使得每行,每列和每個 3X3 小網格中都只包含 1 到 9 這 9 個數字。 下面是一個示例,包含一個經典的謎題及其對應解。
|
||||
|
||||
<div style="margin: auto; background-color: white; padding: 10px; width: 80%; text-align: center;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" align="center">
|
||||
@@ -100,27 +100,27 @@ Su Doku (Japanese meaning *number place*) is the name given to a popular puzzle
|
||||
</table>
|
||||
</div>
|
||||
|
||||
A well constructed Su Doku puzzle has a unique solution and can be solved by logic, although it may be necessary to employ "guess and test" methods in order to eliminate options (there is much contested opinion over this). The complexity of the search determines the difficulty of the puzzle; the example above is considered easy because it can be solved by straight forward direct deduction.
|
||||
一個構造良好的數獨謎題應該只有一個唯一的解,可以通過邏輯解出,雖然可能需要採用“猜測和測試”方法來排除選項(對此有很多爭議的意見)。 搜索的複雜性決定了謎題的難度;上面的示例很簡單,因此可以通過直接的邏輯推理來解出答案。
|
||||
|
||||
The `puzzlesArr` array contains different Su Doku puzzle strings ranging in difficulty, but all with unique solutions.
|
||||
`puzzlesArr` 數組裏有若干個數獨謎題字符串,難度不一,但是每個謎題的解都是唯一的。
|
||||
|
||||
By solving all puzzles in `puzzlesArr`, find the sum of the 3-digit numbers found in the top left corner of each solution grid; for example, 483 is the 3-digit number found in the top left corner of the solution grid above.
|
||||
通過解出 `puzzlesArr` 數組中所有謎題,返回所有解左上角三位數字之和;舉個例子,483 就是上述例子中左上角的三位數字。
|
||||
|
||||
# --hints--
|
||||
|
||||
`suDoku(testPuzzles1)` should return a number.
|
||||
`suDoku(testPuzzles1)` 應該返回一個數字。
|
||||
|
||||
```js
|
||||
assert(typeof suDoku(_testPuzzles1) === 'number');
|
||||
```
|
||||
|
||||
`suDoku(testPuzzles1)` should return `1190`.
|
||||
`suDoku(testPuzzles1)` 應該返回 `1190`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(suDoku(_testPuzzles1), 1190);
|
||||
```
|
||||
|
||||
`suDoku(testPuzzles2)` should return `24702`.
|
||||
`suDoku(testPuzzles2)` 應該返回 `24702`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(suDoku(_testPuzzles2), 24702);
|
||||
|
Reference in New Issue
Block a user