chore(i18n,curriculum): update translations (#43332)

This commit is contained in:
camperbot
2021-08-31 09:47:25 -07:00
committed by GitHub
parent 61b390d075
commit 374876325e
62 changed files with 232 additions and 238 deletions

View File

@ -133,20 +133,28 @@ var MaxHeap = function() {
```js
var MaxHeap = function() {
// Only change code below this line
this.heap = [null];
this.insert = (ele) => {
var index = this.heap.length;
var arr = [...this.heap];
arr.push(ele);
while (ele > arr[Math.floor(index / 2)] && index > 1) {
arr[index] = arr[Math.floor(index / 2)];
arr[Math.floor(index / 2)] = ele;
index = arr[Math.floor(index / 2)];
}
this.heap = arr;
this.heap = [];
this.parent = index => {
return Math.floor((index - 1) / 2);
}
this.insert = element => {
this.heap.push(element);
this.heapifyUp(this.heap.length - 1);
}
this.heapifyUp = index => {
let currentIndex = index,
parentIndex = this.parent(currentIndex);
while (currentIndex > 0 && this.heap[currentIndex] > this.heap[parentIndex]) {
this.swap(currentIndex, parentIndex);
currentIndex = parentIndex;
parentIndex = this.parent(parentIndex);
}
}
this.swap = (index1, index2) => {
[this.heap[index1], this.heap[index2]] = [this.heap[index2], this.heap[index1]];
}
this.print = () => {
return this.heap.slice(1);
return this.heap;
}
// Only change code above this line
};

View File

@ -114,21 +114,29 @@ assert(
## --seed-contents--
```js
var MaxHeap = function() {
this.heap = [null];
this.insert = (ele) => {
var index = this.heap.length;
var arr = [...this.heap];
arr.push(ele);
while (ele > arr[Math.floor(index / 2)] && index > 1) {
arr[index] = arr[Math.floor(index / 2)];
arr[Math.floor(index / 2)] = ele;
index = arr[Math.floor(index / 2)];
var MaxHeap = function () {
this.heap = [];
this.parent = index => {
return Math.floor((index - 1) / 2);
}
this.insert = element => {
this.heap.push(element);
this.heapifyUp(this.heap.length - 1);
}
this.heapifyUp = index => {
let currentIndex = index,
parentIndex = this.parent(currentIndex);
while (currentIndex > 0 && this.heap[currentIndex] > this.heap[parentIndex]) {
this.swap(currentIndex, parentIndex);
currentIndex = parentIndex;
parentIndex = this.parent(parentIndex);
}
this.heap = arr;
}
this.swap = (index1, index2) => {
[this.heap[index1], this.heap[index2]] = [this.heap[index2], this.heap[index1]];
}
this.print = () => {
return this.heap.slice(1);
return this.heap;
}
// Only change code below this line

View File

@ -1,6 +1,6 @@
---
id: 5900f3d01000cf542c50fee3
title: 'Problem 100: Arranged probability'
title: 'Problema 100: Probabilidade com arranjo'
challengeType: 5
forumTopicId: 301724
dashedName: problem-100-arranged-probability
@ -8,47 +8,47 @@ dashedName: problem-100-arranged-probability
# --description--
If a box contains twenty-one colored discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the probability of taking two blue discs.
Suponha que uma caixa tem vinte e um discos coloridos, quinze discos azuis e seis discos vermelhos. Se dois discos forem escolhidos aleatoriamente, é possível ver a probabilidade de receber dois discos azuis.
$${P(BB)} = \frac{15}{21}×\frac{14}{20} = \frac{1}{2}$$
The next such arrangement, for which there is exactly a 50% chance of taking two blue discs at random, is a box containing eighty-five blue discs and thirty-five red discs.
O arranjo seguinte, para o qual há exatamente 50% de chance de pegar dois discos azuis ao acaso, é uma caixa contendo oitenta e cinco discos azuis e trinta e cinco discos vermelhos.
By finding the first arrangement to contain over `limit` discs in total, determine the number of blue discs that the box would contain.
Ao encontrar o primeiro arranjo contendo `limit` discos no total, determine o número de discos azuis que a caixa contém.
# --hints--
`arrangedProbability(20)` should return a number.
`arrangedProbability(20)` deve retornar um número.
```js
assert(typeof arrangedProbability(10) === 'number');
```
`arrangedProbability(20)` should return `15`.
`arrangedProbability(20)` deve retornar `15`.
```js
assert.strictEqual(arrangedProbability(20), 15);
```
`arrangedProbability(100)` should return `85`.
`arrangedProbability(100)` deve retornar `85`.
```js
assert.strictEqual(arrangedProbability(100), 85);
```
`arrangedProbability(100000)` should return `97513`.
`arrangedProbability(100000)` deve retornar `97513`.
```js
assert.strictEqual(arrangedProbability(100000), 97513);
```
`arrangedProbability(1000000000)` should return `3822685023`.
`arrangedProbability(1000000000)` deve retornar `3822685023`.
```js
assert.strictEqual(arrangedProbability(1000000000), 3822685023);
```
`arrangedProbability(1000000000000)` should return `756872327473`.
`arrangedProbability(1000000000000)` deve retornar `756872327473`.
```js
assert.strictEqual(arrangedProbability(1000000000000), 756872327473);

View File

@ -1,6 +1,6 @@
---
id: 5900f3d21000cf542c50fee4
title: 'Problem 101: Optimum polynomial'
title: 'Problema 101: Polinômio ideal'
challengeType: 5
forumTopicId: 301725
dashedName: problem-101-optimum-polynomial
@ -8,29 +8,29 @@ dashedName: problem-101-optimum-polynomial
# --description--
If we are presented with the first k terms of a sequence it is impossible to say with certainty the value of the next term, as there are infinitely many polynomial functions that can model the sequence.
Se nos forem apresentados os primeiros termos k de uma sequência, é impossível dizer com certeza o valor do termo seguinte, uma vez que existem infinitas funções polinomiais que podem modelar a sequência.
As an example, let us consider the sequence of cube numbers. This is defined by the generating function, $u_n = n^3: 1, 8, 27, 64, 125, 216, \ldots$
Como exemplo, vamos considerar a sequencia de números cúbicos. Isso é definido pela função de geração, $u_n = n^3: 1, 8, 27, 64, 125, 216, \ldots$
Suppose we were only given the first two terms of this sequence. Working on the principle that "simple is best" we should assume a linear relationship and predict the next term to be 15 (common difference 7). Even if we were presented with the first three terms, by the same principle of simplicity, a quadratic relationship should be assumed.
Suponhamos que só nos foram dados os dois primeiros termos desta sequência. Trabalhando com o princípio de que "simples é melhor", devemos assumir uma relação linear e prever que o próximo termo será 15 (diferença comum 7). Mesmo que nos fossem apresentados os três primeiros termos, pelo mesmo princípio de simplicidade, uma relação quadrática deveria ser assumida.
We shall define $OP(k, n)$ to be the $n^{th}$ term of the optimum polynomial generating function for the first k terms of a sequence. It should be clear that $OP(k, n)$ will accurately generate the terms of the sequence for $n ≤ k$, and potentially the first incorrect term (FIT) will be $OP(k, k+1)$; in which case we shall call it a bad OP (BOP).
Definiremos $OP(k, n)$ como o termo $n^{th}$ da função de geração polinomial ótima para os primeiros termos k de uma sequência. Deve ficar claro que $OP(k, n)$ gerará com precisão os termos da sequência para $n ≤ k$ e, potencialmente, o primeiro termo incorreto (FIT) será $OP(k, k+1)$; Nesse caso, devemos chamá-lo de OP (BOP) ruim.
As a basis, if we were only given the first term of sequence, it would be most sensible to assume constancy; that is, for $n ≥ 2, OP(1, n) = u_1$.
Como base, se nos fosse dado apenas o primeiro termo de sequência, seria mais sensato assumir constância, ou seja, por $n ≥ 2, OP(1, n) = u_1$.
Hence we obtain the following OPs for the cubic sequence:
Assim, obtemos as seguintes OPs para a sequência cúbica:
$$\begin{array}{ll} OP(1, n) = 1 & 1, {\color{red}1}, 1, 1, \ldots \\\\ OP(2, n) = 7n6 & 1, 8, {\color{red}{15}}, \ldots \\\\ OP(3, n) = 6n^211n+6 & 1, 8, 27, {\color{red}{58}}, \ldots \\\\ OP(4, n) = n^3 & 1, 8, 27, 64, 125, \ldots \end{array}$$
Clearly no BOPs exist for k ≥ 4. By considering the sum of FITs generated by the BOPs (indicated in $\color{red}{red}$ above), we obtain 1 + 15 + 58 = 74. Consider the following tenth degree polynomial generating function:
Claramente não existem BOPs para k ≥ 4. Considerando a soma dos FITs gerados pelos BOPs (indicados em $\color{red}{red}$ acima), obtemos 1 + 15 + 58 = 74. Considere a seguinte função de geração de polinômios de décimo grau:
$$u_n = 1 n + n^2 n^3 + n^4 n^5 + n^6 n^7 + n^8 n^9 + n^{10}$$
Find the sum of FITs for the BOPs.
Encontre a soma dos FITs para os BOPs.
# --hints--
`optimumPolynomial()` should return `37076114526`.
`optimumPolynomial()` deve retornar `37076114526`.
```js
assert.strictEqual(optimumPolynomial(), 37076114526);

View File

@ -1,6 +1,6 @@
---
id: 5900f3d91000cf542c50feeb
title: 'Problem 108: Diophantine Reciprocals I'
title: 'Problema 108: Diofantinos recíprocos I'
challengeType: 5
forumTopicId: 301732
dashedName: problem-108-diophantine-reciprocals-i
@ -8,19 +8,19 @@ dashedName: problem-108-diophantine-reciprocals-i
# --description--
In the following equation x, y, and n are positive integers.
Na equação a seguir, x, y e n são inteiros positivos.
$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$
For `n` = 4 there are exactly three distinct solutions:
Para `n` = 4, há exatamente três soluções distintas:
$$\begin{align} & \frac{1}{5} + \frac{1}{20} = \frac{1}{4}\\\\ \\\\ & \frac{1}{6} + \frac{1}{12} = \frac{1}{4}\\\\ \\\\ & \frac{1}{8} + \frac{1}{8} = \frac{1}{4} \end{align}$$
What is the least value of `n` for which the number of distinct solutions exceeds one-thousand?
Qual é o menor valor de `n` para o qual o número de soluções distintas excede um mil?
# --hints--
`diophantineOne()` should return `180180`.
`diophantineOne()` deve retornar `180180`.
```js
assert.strictEqual(diophantineOne(), 180180);

View File

@ -1,6 +1,6 @@
---
id: 5900f3db1000cf542c50feed
title: 'Problem 110: Diophantine Reciprocals II'
title: 'Problema 110: Diofantinos recíprocos II'
challengeType: 5
forumTopicId: 301735
dashedName: problem-110-diophantine-reciprocals-ii
@ -8,19 +8,19 @@ dashedName: problem-110-diophantine-reciprocals-ii
# --description--
In the following equation x, y, and n are positive integers.
Na equação a seguir, x, y e n são inteiros positivos.
$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$
It can be verified that when `n` = 1260 there are 113 distinct solutions and this is the least value of `n` for which the total number of distinct solutions exceeds one hundred.
Pode ser verificado que, quando `n` = 1260, existem 113 soluções distintas e este é o menor valor de `n` para o qual o número total de soluções distintas excede cem.
What is the least value of `n` for which the number of distinct solutions exceeds four million?
Qual é o menor valor de `n` para o qual o número de soluções distintas excede quatro milhões?
**Note:** This problem is a much more difficult version of Problem 108 and as it is well beyond the limitations of a brute force approach it requires a clever implementation.
**Nota:** este problema é uma versão muito mais difícil do Problema 108 e, como está muito além das limitações de uma abordagem de força bruta, requer uma implementação inteligente.
# --hints--
`diophantineTwo()` should return `9350130049860600`.
`diophantineTwo()` deve retornar `9350130049860600`.
```js
assert.strictEqual(diophantineTwo(), 9350130049860600);

View File

@ -1,6 +1,6 @@
---
id: 5900f3ef1000cf542c50ff02
title: 'Problem 131: Prime cube partnership'
title: 'Problema 131: Associação dos cubos primos'
challengeType: 5
forumTopicId: 301759
dashedName: problem-131-prime-cube-partnership
@ -8,20 +8,20 @@ dashedName: problem-131-prime-cube-partnership
# --description--
There are some prime values, p, for which there exists a positive integer, n, such that the expression n3 + n2p is a perfect cube.
Existem alguns valores primos, $p$, para os quais também existe um número inteiro positivo, $n$, tal que a expressão $n^3 + n^{2}p$ é um cubo perfeito.
For example, when p = 19, 83 + 82×19 = 123.
Por exemplo, quando $p = 19,\\ 8^3 + 8^2 x 19 = {12}^3$.
What is perhaps most surprising is that for each prime with this property the value of n is unique, and there are only four such primes below one-hundred.
O que é talvez mais surpreendente é que o valor de $n$ é único para cada primo com essa propriedade, e só existem 4 primos com essa propriedade abaixo de 100.
How many primes below one million have this remarkable property?
Quantos primos abaixo de 1 milhão possuem essa propriedade notável?
# --hints--
`euler131()` should return 173.
`primeCubePartnership()` deve retornar `173`.
```js
assert.strictEqual(euler131(), 173);
assert.strictEqual(primeCubePartnership(), 173);
```
# --seed--
@ -29,12 +29,12 @@ assert.strictEqual(euler131(), 173);
## --seed-contents--
```js
function euler131() {
function primeCubePartnership() {
return true;
}
euler131();
primeCubePartnership();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f3f11000cf542c50ff03
title: 'Problem 132: Large repunit factors'
title: 'Problema 132: Fatores repunit grandes'
challengeType: 5
forumTopicId: 301760
dashedName: problem-132-large-repunit-factors
@ -8,18 +8,18 @@ dashedName: problem-132-large-repunit-factors
# --description--
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k.
Em inglês, um número que consiste apenas de 1s é chamado de repunit. Devemos definir $R(k)$ como uma repunit de tamanho $k$.
For example, R(10) = 1111111111 = 11×41×271×9091, and the sum of these prime factors is 9414.
Por exemplo, $R(10) = 1111111111 = 11 × 41 × 271 × 9091$, e a soma desses fatores primos é 9414.
Find the sum of the first forty prime factors of R(109).
Encontre a soma dos 40 primeiros fatores primos de $R({10}^9)$.
# --hints--
`euler132()` should return 843296.
`largeRepunitFactors()` deve retornar `843296`.
```js
assert.strictEqual(euler132(), 843296);
assert.strictEqual(largeRepunitFactors(), 843296);
```
# --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler132(), 843296);
## --seed-contents--
```js
function euler132() {
function largeRepunitFactors() {
return true;
}
euler132();
largeRepunitFactors();
```
# --solutions--