chore(i18n,curriculum): update translations (#44122)
This commit is contained in:
@ -29,11 +29,7 @@ dashedName: add-columns-with-grid-template-columns
|
||||
class 爲 `container` 的元素應具有 `grid-template-columns` 屬性,該屬性應有三個屬性值,均爲 `100px`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
code.match(
|
||||
/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?100px\s*?100px\s*?100px\s*?;[\s\S]*}/gi
|
||||
)
|
||||
);
|
||||
assert(new __helpers.CSSHelp(document).getStyle('.container')?.gridTemplateColumns === '100px 100px 100px');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
@ -29,11 +29,7 @@ dashedName: add-columns-with-grid-template-columns
|
||||
class 为 `container` 的元素应具有 `grid-template-columns` 属性,该属性应有三个属性值,均为 `100px`。
|
||||
|
||||
```js
|
||||
assert(
|
||||
code.match(
|
||||
/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?100px\s*?100px\s*?100px\s*?;[\s\S]*}/gi
|
||||
)
|
||||
);
|
||||
assert(new __helpers.CSSHelp(document).getStyle('.container')?.gridTemplateColumns === '100px 100px 100px');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
@ -29,11 +29,7 @@ Haz que el contenedor de la cuadrícula tenga tres columnas con un ancho de `100
|
||||
La clase `container` debe tener la propiedad `grid-template-columns` con tres unidades de `100px`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
code.match(
|
||||
/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?100px\s*?100px\s*?100px\s*?;[\s\S]*}/gi
|
||||
)
|
||||
);
|
||||
assert(new __helpers.CSSHelp(document).getStyle('.container')?.gridTemplateColumns === '100px 100px 100px');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
@ -29,11 +29,7 @@ Assegna al contenitore della griglia tre colonne di larghezza `100px` ciascuna.
|
||||
La classe `container` dovrebbe avere una proprietà `grid-template-columns` con tre unità di `100px`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
code.match(
|
||||
/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?100px\s*?100px\s*?100px\s*?;[\s\S]*}/gi
|
||||
)
|
||||
);
|
||||
assert(new __helpers.CSSHelp(document).getStyle('.container')?.gridTemplateColumns === '100px 100px 100px');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
@ -29,11 +29,7 @@ Dê ao grid container três colunas com `100px` de largura.
|
||||
O elemento de classe `container` deve ter a propriedade `grid-template-columns` com três parâmetros de `100px`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
code.match(
|
||||
/.container\s*?{[\s\S]*grid-template-columns\s*?:\s*?100px\s*?100px\s*?100px\s*?;[\s\S]*}/gi
|
||||
)
|
||||
);
|
||||
assert(new __helpers.CSSHelp(document).getStyle('.container')?.gridTemplateColumns === '100px 100px 100px');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
@ -8,25 +8,87 @@ dashedName: arithmetic-formatter
|
||||
|
||||
# --description--
|
||||
|
||||
Crie uma função que receba uma lista de strings que sejam problemas aritméticos e retorne os problemas dispostos verticalmente e lado a lado.
|
||||
Você [trabalhará neste projeto com nosso código inicial do Replit](https://replit.com/github/freeCodeCamp/boilerplate-arithmetic-formatter).
|
||||
|
||||
Você pode acessar [a descrição completa do projeto e o código inicial no Replit](https://replit.com/github/freeCodeCamp/boilerplate-arithmetic-formatter).
|
||||
Ainda estamos desenvolvendo a parte instrucional interativa do currículo Python. Por enquanto, aqui estão alguns vídeos no canal do freeCodeCamp.org do YouTube que ensinarão tudo o que você precisa saber para completar este projeto:
|
||||
|
||||
Depois de ir para esse link, faça fork no projeto. Depois que você completar o projeto com baseado nas instruções do 'README.md', envie o link do seu projeto abaixo.
|
||||
- [Curso de Python em vídeo para todos](https://www.freecodecamp.org/news/python-for-everybody/) (14 horas)
|
||||
- [Curso Aprenda Python em vídeo](https://www.freecodecamp.org/news/learn-python-video-course/) (10 horas)
|
||||
|
||||
Ainda estamos desenvolvendo a parte instrucional interativa do currículo Python. Por enquanto, aqui estão alguns vídeos no canal freeCodeCamp.org do YouTube que ensinarão tudo o que você precisa saber para completar este projeto:
|
||||
# --instructions--
|
||||
|
||||
<ul> <li>
|
||||
<a href='https://www.freecodecamp.org/news/python-for-everybody/'>Curso de Python em vídeo para todos</a> (14 horas)
|
||||
</li>
|
||||
<li>
|
||||
<a href='https://www.freecodecamp.org/news/learn-python-basics-in-depth-video-course/'>Curso em vídeo Aprenda Python</a> (2 horas)
|
||||
</li>
|
||||
<ul>
|
||||
Os alunos da escola primária geralmente organizam problemas aritméticos de modo vertical para facilitar a sua resolução. Por exemplo, "235 + 52" se torna:
|
||||
|
||||
```py
|
||||
235
|
||||
+ 52
|
||||
-----
|
||||
```
|
||||
|
||||
Crie uma função que receba uma lista de strings que sejam problemas aritméticos e retorne os problemas dispostos verticalmente e lado a lado. A função deve, como opção, receber um segundo argumento. Quando o segundo argumento for definido como `True`, as respostas devem ser exibidas.
|
||||
|
||||
## Exemplo
|
||||
|
||||
Chamada da função:
|
||||
|
||||
```py
|
||||
arithmetic_arranger(["32 + 698", "3801 - 2", "45 + 43", "123 + 49"])
|
||||
```
|
||||
|
||||
Resultado:
|
||||
|
||||
```py
|
||||
32 3801 45 123
|
||||
+ 698 - 2 + 43 + 49
|
||||
----- ------ ---- -----
|
||||
```
|
||||
|
||||
Chamada da função:
|
||||
|
||||
```py
|
||||
arithmetic_arranger(["32 + 8", "1 - 3801", "9999 + 9999", "523 - 49"], True)
|
||||
```
|
||||
|
||||
Resultado:
|
||||
|
||||
```py
|
||||
32 1 9999 523
|
||||
+ 8 - 3801 + 9999 - 49
|
||||
---- ------ ------ -----
|
||||
40 -3800 19998 474
|
||||
```
|
||||
|
||||
## Regras
|
||||
|
||||
A função retornará a conversão correta se os problemas fornecidos forem formatados corretamente. Caso contrário, ela **retornará** uma **string** que descreve um erro significativo para o usuário.
|
||||
|
||||
|
||||
- Situações que retornarão um erro:
|
||||
- Se **houver muitos problemas** fornecidos para a função. O limite é **5**. Qualquer outro número retornará: `Error: Too many problems.`
|
||||
- Os operadores apropriados que a função aceitará são **adição** e **subtração**. A multiplicação e a divisão retornarão um erro. Outros operadores não mencionados aqui não precisarão ser testados. O erro retornado será: `Error: Operator must be '+' or '-'.`
|
||||
- Cada número (operando) deve conter apenas algarismos. Caso contrário, a função retornará: `Error: Numbers must only contain digits.`
|
||||
- Cada operando (ou seja, o número de cada lado do operador) tem, no máximo, quatro algarismos. Do contrário, a string de erro retornada será: `Error: Numbers cannot be more than four digits.`
|
||||
- Se o usuário forneceu o formato correto dos problemas, a conversão retornada seguirá estas regras:
|
||||
- Deve haver um único espaço entre o operador e o maior entre os dois operandos. O operador estará na mesma linha do segundo operando. Ambos os operadores estarão na mesma ordem fornecida - o primeiro será o de cima e o segundo será o de baixo.
|
||||
- Os números devem estar alinhados à direita.
|
||||
- Deve haver quatro espaços entre cada problema.
|
||||
- Deve haver travessões abaixo de cada problema. Os travessões devem compreender todo o tamanho de cada problema individualmente. (O exemplo acima mostra como deve ser a aparência do resultado.)
|
||||
|
||||
## Desenvolvimento
|
||||
|
||||
Escreva seu código em `arithmetic_arranger.py`. Para o desenvolvimento, você pode usar `main.py` para testar sua função `arithmetic_arranger()`. Clique no botão "Run" e `main.py` será executado.
|
||||
|
||||
## Testes
|
||||
|
||||
Os testes unitários para este projeto estão em `test_module.py`. Estamos executando os testes de `test_module.py` em `main.py` para a sua conveniência. Os testes serão executados automaticamente sempre que você clicar no botão "Run". Como alternativa, você pode executar testes inserindo `pytest` no console.
|
||||
|
||||
## Envio
|
||||
|
||||
Copie o URL do seu projeto e envie-o abaixo.
|
||||
|
||||
# --hints--
|
||||
|
||||
O programa deve formatar corretamente um problema aritmético e passar em todos os testes.
|
||||
O projeto deve formatar corretamente um problema aritmético e passar em todos os testes.
|
||||
|
||||
```js
|
||||
|
||||
|
@ -16,7 +16,7 @@ Pode ser verificado que, quando `n` = 1260, existem 113 soluções distintas e e
|
||||
|
||||
Qual é o menor valor de `n` para o qual o número de soluções distintas excede quatro milhões?
|
||||
|
||||
**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.
|
||||
**Observação:** 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--
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3e71000cf542c50fefa
|
||||
title: 'Problem 123: Prime square remainders'
|
||||
title: 'Problema 123: Resto dos quadrados dos primos'
|
||||
challengeType: 5
|
||||
forumTopicId: 301750
|
||||
dashedName: problem-123-prime-square-remainders
|
||||
@ -8,20 +8,20 @@ dashedName: problem-123-prime-square-remainders
|
||||
|
||||
# --description--
|
||||
|
||||
Let pn be the nth prime: 2, 3, 5, 7, 11, ..., and let r be the remainder when (pn−1)n + (pn+1)n is divided by pn2.
|
||||
Considere $p_n$ o $n$-ésimo número primo: 2, 3, 5, 7, 11, ..., e $r$ o resto da divisão quando ${(p_n−1)}^n + {(p_n+1)}^n$ é dividido por ${p_n}^2$.
|
||||
|
||||
For example, when n = 3, p3 = 5, and 43 + 63 = 280 ≡ 5 mod 25.
|
||||
Por exemplo, quando $n = 3, p_3 = 5$ e $4^3 + 6^3 = 280 ≡ 5\\ mod\\ 25$.
|
||||
|
||||
The least value of n for which the remainder first exceeds 109 is 7037.
|
||||
O menor valor de $n$ para o qual o resto excede $10^9$ é 7037.
|
||||
|
||||
Find the least value of n for which the remainder first exceeds 1010.
|
||||
Encontre o menor valor de $n$ para o qual o resto excede $10^{10}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler123()` should return 21035.
|
||||
`primeSquareRemainders()` deve retornar `21035`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler123(), 21035);
|
||||
assert.strictEqual(primeSquareRemainders(), 21035);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler123(), 21035);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler123() {
|
||||
function primeSquareRemainders() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler123();
|
||||
primeSquareRemainders();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3e81000cf542c50fefb
|
||||
title: 'Problem 124: Ordered radicals'
|
||||
title: 'Problema 124: Radicais ordenados'
|
||||
challengeType: 5
|
||||
forumTopicId: 301751
|
||||
dashedName: problem-124-ordered-radicals
|
||||
@ -8,42 +8,118 @@ dashedName: problem-124-ordered-radicals
|
||||
|
||||
# --description--
|
||||
|
||||
The radical of n, rad(n), is the product of the distinct prime factors of n. For example, 504 = 23 × 32 × 7, so rad(504) = 2 × 3 × 7 = 42.
|
||||
O radical de $n, rad(n)$, é o produto dos fatores primos distintos de $n$. Por exemplo, $504 = 2^3 × 3^2 × 7$, então $rad(504) = 2 × 3 × 7 = 42$.
|
||||
|
||||
If we calculate rad(n) for 1 ≤ n ≤ 10, then sort them on rad(n), and sorting on n if the radical values are equal, we get:
|
||||
Se calcularmos $rad(n)$ para $1 ≤ n ≤ 10$ e, em seguida, ordená-los em $rad(n)$, e ordená-los novamente em $n$ se os valores dos radicais forem iguais, obtemos:
|
||||
|
||||
Unsorted
|
||||
<div style="text-align: center;">
|
||||
<table cellpadding="2" cellspacing="0" border="0" align="center">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">$Nao ordenados$</td>
|
||||
<td></td>
|
||||
<td colspan="3">$Ordenados$</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>$n$</td>
|
||||
<td>$rad(n)$</td>
|
||||
<td></td>
|
||||
<td>$n$</td>
|
||||
<td>$rad(n)$</td>
|
||||
<td>$k$</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>1</td>
|
||||
<td></td>
|
||||
<td>1</td>
|
||||
<td>1</td>
|
||||
<td>1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2</td>
|
||||
<td>2</td>
|
||||
<td></td>
|
||||
<td>2</td>
|
||||
<td>2</td>
|
||||
<td>2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3</td>
|
||||
<td>3</td>
|
||||
<td></td>
|
||||
<td>4</td>
|
||||
<td>2</td>
|
||||
<td>3</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>4</td>
|
||||
<td>2</td>
|
||||
<td></td>
|
||||
<td>8</td>
|
||||
<td>2</td>
|
||||
<td>4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>5</td>
|
||||
<td>5</td>
|
||||
<td></td>
|
||||
<td>3</td>
|
||||
<td>3</td>
|
||||
<td>5</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>6</td>
|
||||
<td>6</td>
|
||||
<td></td>
|
||||
<td>9</td>
|
||||
<td>3</td>
|
||||
<td>6</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>7</td>
|
||||
<td>7</td>
|
||||
<td></td>
|
||||
<td>5</td>
|
||||
<td>5</td>
|
||||
<td>7</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8</td>
|
||||
<td>2</td>
|
||||
<td></td>
|
||||
<td>6</td>
|
||||
<td>6</td>
|
||||
<td>8</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>9</td>
|
||||
<td>3</td>
|
||||
<td></td>
|
||||
<td>7</td>
|
||||
<td>7</td>
|
||||
<td>9</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>10</td>
|
||||
<td>10</td>
|
||||
<td></td>
|
||||
<td>10</td>
|
||||
<td>10</td>
|
||||
<td>10</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div><br>
|
||||
|
||||
Sorted n rad(n)
|
||||
|
||||
n rad(n) k 11
|
||||
|
||||
111 22
|
||||
|
||||
222 33
|
||||
|
||||
423 42
|
||||
|
||||
824 55
|
||||
|
||||
335 66
|
||||
|
||||
936 77
|
||||
|
||||
557 82
|
||||
|
||||
668 93
|
||||
|
||||
779 1010
|
||||
|
||||
101010 Let E(k) be the kth element in the sorted n column; for example, E(4) = 8 and E(6) = 9. If rad(n) is sorted for 1 ≤ n ≤ 100000, find E(10000).
|
||||
Considere $E(k)$ como o $k$-ésimo elemento na coluna de ordenados $n$; por exemplo, $E(4) = 8$ e $E(6) = 9$. Se $rad(n)$ estiver ordenado para $1 ≤ n ≤ 100000$, encontre $E(10000)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler124()` should return 21417.
|
||||
`orderedRadicals()` deve retornar `21417`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler124(), 21417);
|
||||
assert.strictEqual(orderedRadicals(), 21417);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -51,12 +127,12 @@ assert.strictEqual(euler124(), 21417);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler124() {
|
||||
function orderedRadicals() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler124();
|
||||
orderedRadicals();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3bb1000cf542c50fece
|
||||
title: 'Problem 79: Passcode derivation'
|
||||
title: 'Problema 79: Derivação de senha'
|
||||
challengeType: 5
|
||||
forumTopicId: 302192
|
||||
dashedName: problem-79-passcode-derivation
|
||||
@ -8,33 +8,33 @@ dashedName: problem-79-passcode-derivation
|
||||
|
||||
# --description--
|
||||
|
||||
A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was `531278`, they may ask for the 2nd, 3rd, and 5th characters; the expected reply would be: `317`.
|
||||
Um método comum de segurança usado pelos serviços bancários on-line é pedir ao usuário três caracteres aleatórios de uma senha. Por exemplo, se a senha for `531278`, eles podem pedir o segundo, o terceiro e o quinto caracteres. A resposta esperada seria: `317`.
|
||||
|
||||
The arrays, `keylog1`, `keylog2`, and `keylog3`, contains fifty successful login attempts.
|
||||
Os arrays, `keylog1`, `keylog2` e `keylog3`, contém cinquenta tentativas de login bem-sucedidas.
|
||||
|
||||
Given that the three characters are always asked for in order, analyze the array so as to determine the shortest possible secret passcode of unknown length.
|
||||
Dado que os três caracteres são sempre solicitados em ordem, analise o array para determinar a senha secreta mais curta possível de tamanho desconhecido.
|
||||
|
||||
# --hints--
|
||||
|
||||
`passcodeDerivation(keylog1)` should return a number.
|
||||
`passcodeDerivation(keylog1)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof passcodeDerivation(_keylog1) === 'number');
|
||||
```
|
||||
|
||||
`passcodeDerivation(keylog1)` should return `531278`.
|
||||
`passcodeDerivation(keylog1)` deve retornar `531278`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(passcodeDerivation(_keylog1), 531278);
|
||||
```
|
||||
|
||||
`passcodeDerivation(keylog2)` should return `1230567`.
|
||||
`passcodeDerivation(keylog2)` deve retornar `1230567`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(passcodeDerivation(_keylog2), 1230567);
|
||||
```
|
||||
|
||||
`passcodeDerivation(keylog3)` should return `73162890`.
|
||||
`passcodeDerivation(keylog3)` deve retornar `73162890`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(passcodeDerivation(_keylog3), 73162890);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3bc1000cf542c50fecf
|
||||
title: 'Problem 80: Square root digital expansion'
|
||||
title: 'Problema 80: Expansão de dígitos da raiz quadrada'
|
||||
challengeType: 5
|
||||
forumTopicId: 302194
|
||||
dashedName: problem-80-square-root-digital-expansion
|
||||
@ -8,33 +8,33 @@ dashedName: problem-80-square-root-digital-expansion
|
||||
|
||||
# --description--
|
||||
|
||||
It is well known that if the square root of a natural number is not an integer, then it is irrational. The decimal expansion of such square roots is infinite without any repeating pattern at all.
|
||||
É do conhecimento geral que se a raiz quadrada de um número natural não é um número inteiro, então é irracional. A expansão decimal de tais raízes quadradas é infinita sem qualquer tipo de padrão de repetição.
|
||||
|
||||
The square root of two is `1.41421356237309504880...`, and the digital sum of the first one hundred decimal digits is `475`.
|
||||
A raiz quadrada de dois é `1.41421356237309504880...`. A soma dos dígitos das primeiras cem casas decimais é `475`.
|
||||
|
||||
For the first `n` natural numbers, find the total of the digital sums of the first one hundred decimal digits for all the irrational square roots.
|
||||
Para os primeiros `n` números naturais, encontre o total das somas dos dígitos das primeiras cem casas decimais para todas as raízes quadradas irracionais.
|
||||
|
||||
# --hints--
|
||||
|
||||
`sqrtDigitalExpansion(2)` should return a number.
|
||||
`sqrtDigitalExpansion(2)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof sqrtDigitalExpansion(2) === 'number');
|
||||
```
|
||||
|
||||
`sqrtDigitalExpansion(2)` should return `475`.
|
||||
`sqrtDigitalExpansion(2)` deve retornar `475`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(sqrtDigitalExpansion(2), 475);
|
||||
```
|
||||
|
||||
`sqrtDigitalExpansion(50)` should return `19543`.
|
||||
`sqrtDigitalExpansion(50)` deve retornar `19543`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(sqrtDigitalExpansion(50), 19543);
|
||||
```
|
||||
|
||||
`sqrtDigitalExpansion(100)` should return `40886`.
|
||||
`sqrtDigitalExpansion(100)` deve retornar `40886`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(sqrtDigitalExpansion(100), 40886);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3bd1000cf542c50fed0
|
||||
title: 'Problem 81: Path sum: two ways'
|
||||
title: 'Problema 81: Soma dos caminhos: duas formas'
|
||||
challengeType: 5
|
||||
forumTopicId: 302195
|
||||
dashedName: problem-81-path-sum-two-ways
|
||||
@ -8,27 +8,27 @@ dashedName: problem-81-path-sum-two-ways
|
||||
|
||||
# --description--
|
||||
|
||||
In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by **only moving to the right and down**, is indicated in bold red and is equal to `2427`.
|
||||
Na matriz de 5 por 5 abaixo, a soma do caminho mínimo do canto superior esquerdo até o canto inferior direito, **movendo-se somente para a direita e para baixo**, é indicado em vermelho e em negrito e é igual a `2427`.
|
||||
|
||||
$$\begin{pmatrix} \color{red}{131} & 673 & 234 & 103 & 18\\\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\ 630 & 803 & \color{red}{746} & \color{red}{422} & 111\\\\ 537 & 699 & 497 & \color{red}{121} & 956\\\\ 805 & 732 & 524 & \color{red}{37} & \color{red}{331} \end{pmatrix}$$
|
||||
|
||||
Find the minimal path sum from the top left to the bottom right by only moving right and down in `matrix`, a 2D array representing a matrix. The maximum matrix size used in the tests will be 80 by 80.
|
||||
Encontre a soma do caminho mínimo, do canto superior esquerdo para o canto inferior direito, movendo-se apenas para a direita e para baixo, na `matrix`, um array bidimensional que representa uma matriz. O tamanho máximo da matriz utilizado nos testes será de 80 por 80.
|
||||
|
||||
# --hints--
|
||||
|
||||
`pathSumTwoWays(testMatrix1)` should return a number.
|
||||
`pathSumTwoWays(testMatrix1)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof pathSumTwoWays(_testMatrix1) === 'number');
|
||||
```
|
||||
|
||||
`pathSumTwoWays(testMatrix1)` should return `2427`.
|
||||
`pathSumTwoWays(testMatrix1)` deve retornar `2427`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(pathSumTwoWays(_testMatrix1), 2427);
|
||||
```
|
||||
|
||||
`pathSumTwoWays(testMatrix2)` should return `427337`.
|
||||
`pathSumTwoWays(testMatrix2)` deve retornar `427337`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(pathSumTwoWays(_testMatrix2), 427337);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3be1000cf542c50fed1
|
||||
title: 'Problem 82: Path sum: three ways'
|
||||
title: 'Problema 82: Soma dos caminhos: três formas'
|
||||
challengeType: 5
|
||||
forumTopicId: 302196
|
||||
dashedName: problem-82-path-sum-three-ways
|
||||
@ -8,29 +8,29 @@ dashedName: problem-82-path-sum-three-ways
|
||||
|
||||
# --description--
|
||||
|
||||
**Note:** This problem is a more challenging version of Problem 81.
|
||||
**Observação:** este problema é uma versão mais difícil do Problema 81.
|
||||
|
||||
The minimal path sum in the 5 by 5 matrix below, by starting in any cell in the left column and finishing in any cell in the right column, and only moving up, down, and right, is indicated in red and bold; the sum is equal to `994`.
|
||||
A soma do caminho mínimo da matriz de 5 por 5 abaixo, iniciando em qualquer célula na coluna da esquerda e terminando em qualquer célula na coluna da direita, e apenas se movendo para cima, para baixo e para a direita, é indicado em vermelho e em negrito. A soma é igual a `994`.
|
||||
|
||||
$$\begin{pmatrix} 131 & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\ 630 & 803 & 746 & 422 & 111\\\\ 537 & 699 & 497 & 121 & 956\\\\ 805 & 732 & 524 & 37 & 331 \end{pmatrix}$$
|
||||
|
||||
Find the minimal path sum from the left column to the right column in `matrix`, a 2D array representing a matrix. The maximum matrix size used in tests will be 80 by 80.
|
||||
Encontre a soma do caminho mínimo, da coluna da esquerda para a coluna da direita, na `matrix`, um array bidimensional que representa uma matriz. O tamanho máximo da matriz utilizado nos testes será de 80 por 80.
|
||||
|
||||
# --hints--
|
||||
|
||||
`pathSumThreeWays(testMatrix1)` should return a number.
|
||||
`pathSumThreeWays(testMatrix1)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof pathSumThreeWays(_testMatrix1) === 'number');
|
||||
```
|
||||
|
||||
`pathSumThreeWays(testMatrix1)` should return `994`.
|
||||
`pathSumThreeWays(testMatrix1)` deve retornar `994`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(pathSumThreeWays(_testMatrix1), 994);
|
||||
```
|
||||
|
||||
`pathSumThreeWays(testMatrix2)` should return `260324`.
|
||||
`pathSumThreeWays(testMatrix2)` deve retornar `260324`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(pathSumThreeWays(_testMatrix2), 260324);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3bf1000cf542c50fed2
|
||||
title: 'Problem 83: Path sum: four ways'
|
||||
title: 'Problema 83: Soma dos caminhos: quatro formas'
|
||||
challengeType: 5
|
||||
forumTopicId: 302197
|
||||
dashedName: problem-83-path-sum-four-ways
|
||||
@ -8,29 +8,29 @@ dashedName: problem-83-path-sum-four-ways
|
||||
|
||||
# --description--
|
||||
|
||||
**Note:** This problem is a significantly more challenging version of Problem 81.
|
||||
**Observação:** este problema é uma versão significativamente mais difícil do Problema 81.
|
||||
|
||||
In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by moving left, right, up, and down, is indicated in bold red and is equal to `2297`.
|
||||
Na matriz de 5 por 5 abaixo, a soma do caminho mínimo do canto superior esquerdo até o canto inferior direito, movendo-se para a esquerda, para a direita, para cima e para baixo, é indicado em vermelho e em negrito e é igual a `2297`.
|
||||
|
||||
$$\begin{pmatrix} \color{red}{131} & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & \color{red}{150}\\\\ 630 & 803 & 746 & \color{red}{422} & \color{red}{111}\\\\ 537 & 699 & 497 & \color{red}{121} & 956\\\\ 805 & 732 & 524 & \color{red}{37} & \color{red}{331} \end{pmatrix}$$
|
||||
|
||||
Find the minimal path sum from the top left to the bottom right by moving left, right, up, and down in `matrix`, a 2D array representing a matrix. The maximum matrix size used in tests will be 80 by 80.
|
||||
Encontre a soma do caminho mínimo, do canto superior esquerdo para o canto inferior direito, movendo-se para a esquerda, para a direita, para cima e para baixo, na `matrix`, um array bidimensional que representa uma matriz. O tamanho máximo da matriz utilizado nos testes será de 80 por 80.
|
||||
|
||||
# --hints--
|
||||
|
||||
`pathSumFourWays(testMatrix1)` should return a number.
|
||||
`pathSumFourWays(testMatrix1)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof pathSumFourWays(_testMatrix1) === 'number');
|
||||
```
|
||||
|
||||
`pathSumFourWays(testMatrix1)` should return `2297`.
|
||||
`pathSumFourWays(testMatrix1)` deve retornar `2297`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(pathSumFourWays(_testMatrix1), 2297);
|
||||
```
|
||||
|
||||
`pathSumFourWays(testMatrix2)` should return `425185`.
|
||||
`pathSumFourWays(testMatrix2)` deve retornar `425185`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(pathSumFourWays(_testMatrix2), 425185);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3c11000cf542c50fed3
|
||||
title: 'Problem 84: Monopoly odds'
|
||||
title: 'Problem 84: Probabilidades no Monopoly'
|
||||
challengeType: 5
|
||||
forumTopicId: 302198
|
||||
dashedName: problem-84-monopoly-odds
|
||||
@ -8,7 +8,7 @@ dashedName: problem-84-monopoly-odds
|
||||
|
||||
# --description--
|
||||
|
||||
In the game, *Monopoly*, the standard board is set up in the following way:
|
||||
No jogo, *Monopoly*, o tabuleiro padrão é configurado da seguinte maneira:
|
||||
|
||||
<div style="text-align: center;">
|
||||
<table cellspacing="1" cellpadding="5" border="0" style="background-color: black; color: black;" align="center">
|
||||
@ -88,69 +88,69 @@ In the game, *Monopoly*, the standard board is set up in the following way:
|
||||
</table>
|
||||
</div><br>
|
||||
|
||||
A player starts on the GO square and adds the scores on two 6-sided dice to determine the number of squares they advance in a clockwise direction. Without any further rules we would expect to visit each square with equal probability: 2.5%. However, landing on G2J (Go To Jail), CC (community chest), and CH (chance) changes this distribution.
|
||||
Um jogador começa no quadrado GO e adiciona as pontuações de dois dados de 6 lados para determinar o número de quadrados que ele avança no sentido horário. Sem adicionarmos outras regras, esperaríamos visitar cada quadrado com igual probabilidade: 2,5%. No entanto, cair em G2J (Go To Jail), CC (Community Chest) e CH (Chance) altera esta distribuição.
|
||||
|
||||
In addition to G2J, and one card from each of CC and CH, that orders the player to go directly to jail, if a player rolls three consecutive doubles, they do not advance the result of their 3rd roll. Instead they proceed directly to jail.
|
||||
Além de G2J, e de uma carta de cada, CC e CH, que ordena ao jogador que vá diretamente para a prisão, se um jogador rolar o mesmo número nos dois dados três vezes seguidas, eles não avançam o resultado da terceira jogada. Em vez disso, eles vão para a prisão diretamente.
|
||||
|
||||
At the beginning of the game, the CC and CH cards are shuffled. When a player lands on CC or CH they take a card from the top of the respective pile and, after following the instructions, it is returned to the bottom of the pile. There are sixteen cards in each pile, but for the purpose of this problem we are only concerned with cards that order a movement; any instruction not concerned with movement will be ignored and the player will remain on the CC/CH square.
|
||||
No início do jogo, as cartas de CC e de CH são embaralhadas. Quando um jogador cai em CC ou em CH, ele tira uma carta do topo da pilha respectiva, e, após seguir as instruções, ela é retornada para o fim da pilha. Existem dezesseis cartas em cada pilha, mas, para efeito deste problema, nos preocupamos apenas com as cartas que ordenam um movimento; qualquer instrução que não tenha a ver com movimento será ignorada e o jogador permanecerá no quadrado CC/CH.
|
||||
|
||||
<ul>
|
||||
<li>Community Chest (2/16 cards):</li>
|
||||
<li>Community Chest (2 cartas em 16):</li>
|
||||
<ol>
|
||||
<li>Advance to GO</li>
|
||||
<li>Go to JAIL</li>
|
||||
<li>Avançar para o GO</li>
|
||||
<li>Ir para JAIL (prisão)</li>
|
||||
</ol>
|
||||
|
||||
<li>Chance (10/16 cards):</li>
|
||||
<li>Chance (10 cartas de 16):</li>
|
||||
<ol>
|
||||
<li>Advance to GO</li>
|
||||
<li>Go to JAIL</li>
|
||||
<li>Go to C1</li>
|
||||
<li>Go to E3</li>
|
||||
<li>Go to H2</li>
|
||||
<li>Go to R1</li>
|
||||
<li>Go to next R (railway company)</li>
|
||||
<li>Go to next R</li>
|
||||
<li>Go to next U (utility company)</li>
|
||||
<li>Go back 3 squares.</li>
|
||||
<li>Avançar para o GO</li>
|
||||
<li>Ir para JAIL (prisão)</li>
|
||||
<li>Ir para C1</li>
|
||||
<li>Ir para E3</li>
|
||||
<li>Ir para H2</li>
|
||||
<li>Ir para R1</li>
|
||||
<li>Ir para a próxima R (companhia ferroviária)</li>
|
||||
<li>Ir para a próxima R</li>
|
||||
<li>Ir para a próxima U (empresa de serviços)</li>
|
||||
<li>Voltar 3 quadrados.</li>
|
||||
</ol>
|
||||
</ul>
|
||||
|
||||
The heart of this problem concerns the likelihood of visiting a particular square. That is, the probability of finishing at that square after a roll. For this reason it should be clear that, with the exception of G2J for which the probability of finishing on it is zero, the CH squares will have the lowest probabilities, as 5/8 request a movement to another square, and it is the final square that the player finishes at on each roll that we are interested in. We shall make no distinction between "Just Visiting" and being sent to JAIL, and we shall also ignore the rule about requiring a double to "get out of jail", assuming that they pay to get out on their next turn.
|
||||
O centro deste problema diz respeito à possibilidade de visitar um determinado quadrado. Ou seja, a probabilidade de terminar naquele quadrado depois de uma jogada dos dados. Por esta razão, deveria ficar claro que, com a exceção da G2J, para a qual a probabilidade de terminar em cima dela é zero, os quadrados em CH terão as menores probabilidades, já que 5 a cada 8 solicitam um movimento para outro quadrado, e é o último quadrado em que o jogador fica em cada jogada que nos interessa. Não estabeleceremos qualquer distinção entre o "Just Visiting" (estar só de passagem) e ser enviado para JAIL (prisão), e também ignoraremos a regra sobre a exigência de uma rolada de dois números iguais nos dados para "sair da cadeia", assumindo que eles pagam para sair no próximo turno.
|
||||
|
||||
By starting at GO and numbering the squares sequentially from 00 to 39 we can concatenate these two-digit numbers to produce strings that correspond with sets of squares.
|
||||
Começando em GO e numerando os quadrados sequencialmente, de 00 a 39, podemos concatenar esses números de dois algarismos para produzir strings que correspondem a conjuntos de quadrados.
|
||||
|
||||
Statistically it can be shown that the three most popular squares, in order, are JAIL (6.24%) = Square 10, E3 (3.18%) = Square 24, and GO (3.09%) = Square 00. So these three most popular squares can be listed with the six-digit modal string `102400`.
|
||||
Estatisticamente, pode ser mostrado que os três quadrados mais populares, em ordem, são JAIL (6,24%) = Quadrado 10, E3 (3,18%) = Quadrado 24 e GO (3,09%) = Quadrado 00. Então, esses três quadrados mais populares podem ser listados com a string modal de seis dígitos `102400`.
|
||||
|
||||
If, instead of using two 6-sided dice, two `n`-sided dice are used, find the six-digit modal string.
|
||||
Se, ao invés de usar dois dados de 6 lados, dois dados de `n` lados forem usados, encontre a string modal de 6 dígitos.
|
||||
|
||||
# --hints--
|
||||
|
||||
`monopolyOdds(8)` should return a string.
|
||||
`monopolyOdds(8)` deve retornar uma string.
|
||||
|
||||
```js
|
||||
assert(typeof monopolyOdds(8) === 'string');
|
||||
```
|
||||
|
||||
`monopolyOdds(8)` should return string `102400`.
|
||||
`monopolyOdds(8)` deve retornar a string `102400`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(monopolyOdds(8), '102400');
|
||||
```
|
||||
|
||||
`monopolyOdds(10)` should return string `100024`.
|
||||
`monopolyOdds(10)` deve retornar a string `100024`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(monopolyOdds(10), '100024');
|
||||
```
|
||||
|
||||
`monopolyOdds(20)` should return string `100005`.
|
||||
`monopolyOdds(20)` deve retornar a string `100005`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(monopolyOdds(20), '100005');
|
||||
```
|
||||
|
||||
`monopolyOdds(4)` should return string `101524`.
|
||||
`monopolyOdds(4)` deve retornar a string `101524`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(monopolyOdds(4), '101524');
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3c11000cf542c50fed4
|
||||
title: 'Problem 85: Counting rectangles'
|
||||
title: 'Problema 85: Contagem de retângulos'
|
||||
challengeType: 5
|
||||
forumTopicId: 302199
|
||||
dashedName: problem-85-counting-rectangles
|
||||
@ -8,45 +8,45 @@ dashedName: problem-85-counting-rectangles
|
||||
|
||||
# --description--
|
||||
|
||||
By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles:
|
||||
Se contarmos com cuidado, poderemos ver que uma grade retangular que mede 3 por 2 contém dezoito retângulos:
|
||||
|
||||
<img class="img-responsive center-block" alt="a diagram of the different rectangles found within a 3 by 2 rectangular grid" src="https://cdn-media-1.freecodecamp.org/project-euler/counting-rectangles.png" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="um diagrama de retângulos diferentes encontrados dentro de uma grade retangular de 3 por 2" src="https://cdn-media-1.freecodecamp.org/project-euler/counting-rectangles.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Although there may not exists a rectangular grid that contains exactly `n` rectangles, find the area of the grid with the nearest solution.
|
||||
Embora possa não existir uma grade retangular que contenha exatamente `n` retângulos, calcule a área da grade com a solução mais próxima.
|
||||
|
||||
# --hints--
|
||||
|
||||
`countingRectangles(18)` should return a number.
|
||||
`countingRectangles(18)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof countingRectangles(18) === 'number');
|
||||
```
|
||||
|
||||
`countingRectangles(18)` should return `6`.
|
||||
`countingRectangles(18)` deve retornar `6`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(countingRectangles(18), 6);
|
||||
```
|
||||
|
||||
`countingRectangles(250)` should return `22`.
|
||||
`countingRectangles(250)` deve retornar `22`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(countingRectangles(250), 22);
|
||||
```
|
||||
|
||||
`countingRectangles(50000)` should return `364`.
|
||||
`countingRectangles(50000)` deve retornar `364`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(countingRectangles(50000), 364);
|
||||
```
|
||||
|
||||
`countingRectangles(1000000)` should return `1632`.
|
||||
`countingRectangles(1000000)` deve retornar `1632`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(countingRectangles(1000000), 1632);
|
||||
```
|
||||
|
||||
`countingRectangles(2000000)` should return `2772`.
|
||||
`countingRectangles(2000000)` deve retornar `2772`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(countingRectangles(2000000), 2772);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3c31000cf542c50fed5
|
||||
title: 'Problem 86: Cuboid route'
|
||||
title: 'Problema 86: Rota de um cuboide'
|
||||
challengeType: 5
|
||||
forumTopicId: 302200
|
||||
dashedName: problem-86-cuboid-route
|
||||
@ -8,43 +8,43 @@ dashedName: problem-86-cuboid-route
|
||||
|
||||
# --description--
|
||||
|
||||
A spider, S, sits in one corner of a cuboid room, measuring 6 by 5 by 3, and a fly, F, sits in the opposite corner. By travelling on the surfaces of the room the shortest "straight line" distance from S to F is 10 and the path is shown on the diagram.
|
||||
Uma aranha, S, está no canto de uma sala em formato de cubo, medindo 6 por 3, e uma mosca, F, fica no canto oposto. Ao passear pelas superfícies da sala, a menor distância de "linha reta" entre S e F é 10 e o caminho é mostrado no diagrama.
|
||||
|
||||
<img class="img-responsive center-block" alt="a diagram of a spider and fly's path from one corner of a cuboid room to the opposite corner" src="https://cdn-media-1.freecodecamp.org/project-euler/cuboid-route.png" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="um diagrama do caminho entre uma aranha e uma mosca a partir de um canto de uma sala no formato de cubo até o canto oposto" src="https://cdn-media-1.freecodecamp.org/project-euler/cuboid-route.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
However, there are up to three "shortest" path candidates for any given cuboid and the shortest route doesn't always have integer length.
|
||||
No entanto, há até três candidatos a caminhos "mais curtos" para qualquer cuboide dado. O caminho mais curto nem sempre tem o tamanho expresso em números inteiros.
|
||||
|
||||
It can be shown that there are exactly `2060` distinct cuboids, ignoring rotations, with integer dimensions, up to a maximum size of M by M by M, for which the shortest route has integer length when M = 100. This is the least value of M for which the number of solutions first exceeds two thousand; the number of solutions when M = 99 is `1975`.
|
||||
Pode-se mostrar aqui que há exatamente `2060` cubos distintos, ignorando rotações, com dimensões inteiras, até um tamanho máximo de M por M por M, para os quais a rota mais curta tem comprimento inteiro quando M = 100. Este é o menor valor de M para o qual o número de soluções excede duas mil. O número de soluções quando M = 99 é `1975`.
|
||||
|
||||
Find the least value of M such that the number of solutions first exceeds `n`.
|
||||
Encontre o menor valor de M, de modo que o número de soluções exceda `n`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`cuboidRoute(2000)` should return a number.
|
||||
`cuboidRoute(2000)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof cuboidRoute(2000) === 'number');
|
||||
```
|
||||
|
||||
`cuboidRoute(2000)` should return `100`.
|
||||
`cuboidRoute(2000)` deve retornar `100`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(cuboidRoute(2000), 100);
|
||||
```
|
||||
|
||||
`cuboidRoute(25000)` should return `320`.
|
||||
`cuboidRoute(25000)` deve retornar `320`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(cuboidRoute(25000), 320);
|
||||
```
|
||||
|
||||
`cuboidRoute(500000)` should return `1309`.
|
||||
`cuboidRoute(500000)` deve retornar `1309`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(cuboidRoute(500000), 1309);
|
||||
```
|
||||
|
||||
`cuboidRoute(1000000)` should return `1818`.
|
||||
`cuboidRoute(1000000)` deve retornar `1818`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(cuboidRoute(1000000), 1818);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3c51000cf542c50fed8
|
||||
title: 'Problem 87: Prime power triples'
|
||||
title: 'Problema 87: Trios de potência de primos'
|
||||
challengeType: 5
|
||||
forumTopicId: 302201
|
||||
dashedName: problem-87-prime-power-triples
|
||||
@ -8,7 +8,7 @@ dashedName: problem-87-prime-power-triples
|
||||
|
||||
# --description--
|
||||
|
||||
The smallest number expressible as the sum of a prime square, prime cube, and prime fourth power is `28`. In fact, there are exactly four numbers below fifty that can be expressed in such a way:
|
||||
O menor número que pode ser expresso como a soma de um quadrado de primo, cubo de primos e primos na quarta potência é `28`. Na verdade, há exatamente quatro números abaixo de cinquenta que podem ser expressos dessa forma:
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
28 = 2<sup>2</sup> + 2<sup>3</sup> + 2<sup>4</sup><br>
|
||||
@ -17,41 +17,41 @@ The smallest number expressible as the sum of a prime square, prime cube, and pr
|
||||
47 = 2<sup>2</sup> + 3<sup>3</sup> + 2<sup>4</sup>
|
||||
</div><br>
|
||||
|
||||
How many numbers below `n` can be expressed as the sum of a prime square, prime cube, and prime fourth power?
|
||||
Quantos números abaixo de `n` podem ser expressos como a soma do quadrado de um número primo, do cubo de um número primo e de um número primo na quarta potência?
|
||||
|
||||
# --hints--
|
||||
|
||||
`primePowerTriples(50)` should return a number.
|
||||
`primePowerTriples(50)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof primePowerTriples(50) === 'number');
|
||||
```
|
||||
|
||||
`primePowerTriples(50)` should return `4`.
|
||||
`primePowerTriples(50)` deve retornar `4`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(primePowerTriples(50), 4);
|
||||
```
|
||||
|
||||
`primePowerTriples(10035)` should return `684`.
|
||||
`primePowerTriples(10035)` deve retornar `684`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(primePowerTriples(10035), 684);
|
||||
```
|
||||
|
||||
`primePowerTriples(500000)` should return `18899`.
|
||||
`primePowerTriples(500000)` deve retornar `18899`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(primePowerTriples(500000), 18899);
|
||||
```
|
||||
|
||||
`primePowerTriples(5000000)` should return `138932`.
|
||||
`primePowerTriples(5000000)` deve retornar `138932`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(primePowerTriples(5000000), 138932);
|
||||
```
|
||||
|
||||
`primePowerTriples(50000000)` should return `1097343`.
|
||||
`primePowerTriples(50000000)` deve retornar `1097343`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(primePowerTriples(50000000), 1097343);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3c51000cf542c50fed6
|
||||
title: 'Problem 88: Product-sum numbers'
|
||||
title: 'Problema 88: Números de somas e produtos'
|
||||
challengeType: 5
|
||||
forumTopicId: 302203
|
||||
dashedName: problem-88-product-sum-numbers
|
||||
@ -8,11 +8,11 @@ dashedName: problem-88-product-sum-numbers
|
||||
|
||||
# --description--
|
||||
|
||||
A natural number, `N`, that can be written as the sum and product of a given set of at least two natural numbers, $\\{a_1, a_2, \ldots , a_k\\}$ is called a product-sum number: $N = a_1 + a_2 + \cdots + a_k = a_1 × a_2 × \cdots × a_k$.
|
||||
Um número natural, `N`, que pode ser escrito como a soma e o produto de um determinado conjunto de, pelo menos, dois números naturais, $\\{a_1, a_2, \ldots , a_k\\}$, é chamado de um número de soma e produto: $N = a_1 + a_2 + \cdots + a_k = a_1 × a_2 × \cdots × a_k$.
|
||||
|
||||
For example, 6 = 1 + 2 + 3 = 1 × 2 × 3.
|
||||
Por exemplo: 6 = 1 + 2 + 3 = 1 x 2 x 3.
|
||||
|
||||
For a given set of size, `k`, we shall call the smallest N with this property a minimal product-sum number. The minimal product-sum numbers for sets of size, `k` = 2, 3, 4, 5, and 6 are as follows.
|
||||
Para um determinado conjunto de tamanho `k`, vamos chamar o menor número N com essa propriedade de número mínimo de soma e produto. Os números mínimos de soma e produto para conjuntos de tamanho `k` = 2, 3, 4, 5 e 6 são os seguintes.
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
<var>k</var>=2: 4 = 2 × 2 = 2 + 2<br>
|
||||
@ -22,45 +22,45 @@ For a given set of size, `k`, we shall call the smallest N with this property a
|
||||
<var>k</var>=6: 12 = 1 × 1 × 1 × 1 × 2 × 6 = 1 + 1 + 1 + 1 + 2 + 6
|
||||
</div><br>
|
||||
|
||||
Hence for 2 ≤ `k` ≤ 6, the sum of all the minimal product-sum numbers is 4 + 6 + 8 + 12 = 30; note that `8` is only counted once in the sum.
|
||||
Assim, para 2 ≤ `k` ≤ 6, a soma de todos os números mínimos de soma e produto é 4 + 6 + 8 + 12 = 30. Observe que `8` é contado apenas uma vez na soma.
|
||||
|
||||
In fact, as the complete set of minimal product-sum numbers for 2 ≤ `k` ≤ 12 is $\\{4, 6, 8, 12, 15, 16\\}$, the sum is `61`.
|
||||
De fato, como o conjunto completo de números mínimos de soma e produto para 2 ≤ `k` ≤ 12 é $\\{4, 6, 8, 12, 15, 16\\}$, a soma é `61`.
|
||||
|
||||
What is the sum of all the minimal product-sum numbers for 2 ≤ `k` ≤ `limit`?
|
||||
Qual é a soma de todos os números mínimos de soma e produto para 2 ≤ `k` ≤ `limit`?
|
||||
|
||||
# --hints--
|
||||
|
||||
`productSumNumbers(6)` should return a number.
|
||||
`productSumNumbers(6)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof productSumNumbers(6) === 'number');
|
||||
```
|
||||
|
||||
`productSumNumbers(6)` should return `30`.
|
||||
`productSumNumbers(6)` deve retornar `30`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(productSumNumbers(6), 30);
|
||||
```
|
||||
|
||||
`productSumNumbers(12)` should return `61`.
|
||||
`productSumNumbers(12)` deve retornar `61`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(productSumNumbers(12), 61);
|
||||
```
|
||||
|
||||
`productSumNumbers(300)` should return `12686`.
|
||||
`productSumNumbers(300)` deve retornar `12686`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(productSumNumbers(300), 12686);
|
||||
```
|
||||
|
||||
`productSumNumbers(6000)` should return `2125990`.
|
||||
`productSumNumbers(6000)` deve retornar `2125990`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(productSumNumbers(6000), 2125990);
|
||||
```
|
||||
|
||||
`productSumNumbers(12000)` should return `7587457`.
|
||||
`productSumNumbers(12000)` deve retornar `7587457`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(productSumNumbers(12000), 7587457);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3c51000cf542c50fed7
|
||||
title: 'Problem 89: Roman numerals'
|
||||
title: 'Problema 89: Números romanos'
|
||||
challengeType: 5
|
||||
forumTopicId: 302204
|
||||
dashedName: problem-89-roman-numerals
|
||||
@ -8,20 +8,20 @@ dashedName: problem-89-roman-numerals
|
||||
|
||||
# --description--
|
||||
|
||||
For a number written in Roman numerals to be considered valid there are basic rules which must be followed. Even though the rules allow some numbers to be expressed in more than one way there is always a *best* way of writing a particular number.
|
||||
Para que um número escrito em numerais romanos seja considerado válido, há regras básicas que têm de ser cumpridas. Embora as regras permitam que alguns números sejam expressos de mais de uma forma, há sempre uma forma *melhor* de escrever um número específico.
|
||||
|
||||
- Numerals must be arranged in descending order of size.
|
||||
- M, C, and X cannot be equaled or exceeded by smaller denominations.
|
||||
- D, L, and V can each only appear once.
|
||||
- Os números devem ser organizados em ordem decrescente de tamanho.
|
||||
- M, C e X não podem ser igualados ou excedidos por denominações menores.
|
||||
- D, L e V só podem aparecer uma vez.
|
||||
|
||||
In addition to the three rules given above, if subtractive combinations are used then the following four rules must be followed.
|
||||
Além das três regras dadas acima, se as combinações subtrativas forem usadas, as quatro regras a seguir devem ser seguidas.
|
||||
|
||||
- Only one I, X, and C can be used as the leading numeral in part of a subtractive pair.
|
||||
- I can only be placed before V and X.
|
||||
- X can only be placed before L and C.
|
||||
- C can only be placed before D and M.
|
||||
- Somente um I, X e C podem ser usados como numerais adiante de um par subtrativo.
|
||||
- I só pode ser colocado antes de V e de X.
|
||||
- X só pode ser colocado antes de L e de C.
|
||||
- C só pode ser colocado antes de D e de M.
|
||||
|
||||
For example, it would appear that there are at least six ways of writing the number sixteen:
|
||||
Por exemplo, poderíamos imaginar que há pelo menos seis maneiras de escrever o número dezesseis:
|
||||
|
||||
<div style="margin-left: 4em; font-family: 'courier new', monospace;">
|
||||
IIIIIIIIIIIIIIII<br>
|
||||
@ -32,29 +32,29 @@ For example, it would appear that there are at least six ways of writing the num
|
||||
XVI<br><br>
|
||||
</div>
|
||||
|
||||
However, according to the rules only XIIIIII and XVI are valid, and the last example is considered to be the most efficient, as it uses the least number of numerals.
|
||||
Porém, de acordo com as regras, somente XIIIIII e XVI são válidos. O último desses exemplos é considerado o mais eficiente, já que usa a menor quantidade de numerais.
|
||||
|
||||
The array, `roman`, will contain numbers written with valid, but not necessarily minimal, Roman numerals.
|
||||
O array, `roman`, terá números escritos de maneira válida, mas não necessariamente mínima, de numerais romanos.
|
||||
|
||||
Find the number of characters saved by writing each of these in their minimal form.
|
||||
Encontre o número de caracteres salvos escrevendo cada um deles na sua forma mínima.
|
||||
|
||||
**Note:** You can assume that all the Roman numerals in the array contain no more than four consecutive identical units.
|
||||
**Observação:** você pode considerar que nenhum dos números romanos no array contêm mais do que quatro unidades idênticas consecutivas.
|
||||
|
||||
# --hints--
|
||||
|
||||
`romanNumerals(testNumerals1)` should return a number.
|
||||
`romanNumerals(testNumerals1)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof romanNumerals(_testNumerals1) === 'number');
|
||||
```
|
||||
|
||||
`romanNumerals(testNumerals1)` should return `19`.
|
||||
`romanNumerals(testNumerals1)` deve retornar `19`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(romanNumerals(_testNumerals1), 19);
|
||||
```
|
||||
|
||||
`romanNumerals(testNumerals2)` should return `743`.
|
||||
`romanNumerals(testNumerals2)` deve retornar `743`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(romanNumerals(_testNumerals2), 743);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3c61000cf542c50fed9
|
||||
title: 'Problem 90: Cube digit pairs'
|
||||
title: 'Problema 90: pares de algarismos em cubos'
|
||||
challengeType: 5
|
||||
forumTopicId: 302207
|
||||
dashedName: problem-90-cube-digit-pairs
|
||||
@ -8,38 +8,38 @@ dashedName: problem-90-cube-digit-pairs
|
||||
|
||||
# --description--
|
||||
|
||||
Each of the six faces on a cube has a different digit (0 to 9) written on it; the same is done to a second cube. By placing the two cubes side-by-side in different positions we can form a variety of 2-digit numbers.
|
||||
Cada uma das seis faces em um cubo tem um algarismo diferente (de 0 a 9) escrito nela. O mesmo se passa com um segundo cubo. Colocando os dois cubos lado a lado em posições diferentes, podemos formar uma variedade de números de dois algarismos.
|
||||
|
||||
For example, the square number 64 could be formed:
|
||||
Por exemplo, o número quadrado 64 poderia ser formado assim:
|
||||
|
||||
<img class="img-responsive center-block" alt="two cubes, one with the number 6 and the other with number 4" src="https://cdn-media-1.freecodecamp.org/project-euler/cube-digit-pairs.png" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="dois cubos, um com o número 6 e o outro com o número 4" src="https://cdn-media-1.freecodecamp.org/project-euler/cube-digit-pairs.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
In fact, by carefully choosing the digits on both cubes it is possible to display all of the square numbers below one-hundred: 01, 04, 09, 16, 25, 36, 49, 64, and 81.
|
||||
De fato, se escolhermos cuidadosamente os algarismos em ambos os cubos, é possível exibir todos os números quadrados abaixo de cem: 01, 04, 09, 16, 25, 36, 49, 64 e 81.
|
||||
|
||||
For example, one way this can be achieved is by placing {0, 5, 6, 7, 8, 9} on one cube and {1, 2, 3, 4, 8, 9} on the other cube.
|
||||
Por exemplo, uma forma de conseguir isso é colocando {0, 5, 6, 7, 8, 9} em um cubo e {1, 2, 3, 4, 8, 9} no outro cubo.
|
||||
|
||||
However, for this problem we shall allow the 6 or 9 to be turned upside-down so that an arrangement like {0, 5, 6, 7, 8, 9} and {1, 2, 3, 4, 6, 7} allows for all nine square numbers to be displayed; otherwise it would be impossible to obtain 09.
|
||||
No entanto, para este problema, permitiremos que os 6 ou 9 sejam invertidos de forma que um arranjo como {0, 5, 6, 7, 8, 9} e {1, 2, 3, 4, 6, 7} permita que todos os nove números quadrados sejam exibidos. Caso contrário, seria impossível obter 09.
|
||||
|
||||
In determining a distinct arrangement we are interested in the digits on each cube, not the order.
|
||||
Ao estabelecermos um arranjo distinta, estamos interessados nos algarismos de cada cubo, não na ordem.
|
||||
|
||||
<div style="margin-left: 4em;">
|
||||
{1, 2, 3, 4, 5, 6} is equivalent to {3, 6, 4, 1, 2, 5}<br>
|
||||
{1, 2, 3, 4, 5, 6} is distinct from {1, 2, 3, 4, 5, 9}
|
||||
{1, 2, 3, 4, 5, 6} é equivalente a {3, 6, 4, 1, 2, 5}<br>
|
||||
{1, 2, 3, 4, 5, 6} é diferente de {1, 2, 3, 4, 5, 9}
|
||||
</div>
|
||||
|
||||
But because we are allowing 6 and 9 to be reversed, the two distinct sets in the last example both represent the extended set {1, 2, 3, 4, 5, 6, 9} for the purpose of forming 2-digit numbers.
|
||||
Como estamos permitindo que 6 e 9 sejam invertidos, os dois conjuntos distintos no último exemplo representam o conjunto estendido {1, 2, 3, 4, 5, 6, 9} para fins de formar números de dois algarismos.
|
||||
|
||||
How many distinct arrangements of the two cubes allow for all of the square numbers to be displayed?
|
||||
Quantos arranjos distintos dos dois cubos permitem a exibição de todos os números quadrados até cem?
|
||||
|
||||
# --hints--
|
||||
|
||||
`cubeDigitPairs()` should return a number.
|
||||
`cubeDigitPairs()` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof cubeDigitPairs() === 'number');
|
||||
```
|
||||
|
||||
`cubeDigitPairs()` should return 1217.
|
||||
`cubeDigitPairs()` deve retornar 1217.
|
||||
|
||||
```js
|
||||
assert.strictEqual(cubeDigitPairs(), 1217);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3c71000cf542c50feda
|
||||
title: 'Problem 91: Right triangles with integer coordinates'
|
||||
title: 'Problema 91: Triângulos retângulos com coordenadas inteiras'
|
||||
challengeType: 5
|
||||
forumTopicId: 302208
|
||||
dashedName: problem-91-right-triangles-with-integer-coordinates
|
||||
@ -8,43 +8,43 @@ dashedName: problem-91-right-triangles-with-integer-coordinates
|
||||
|
||||
# --description--
|
||||
|
||||
The points ${P}(x_1, y_1)$ and ${Q}(x_2, y_2)$ are plotted at integer co-ordinates and are joined to the origin, ${O}(0, 0)$, to form ${\Delta}OPQ$.
|
||||
Os pontos ${P}(x_1, y_1)$ e ${Q}(x_2, y_2)$ são desenhados em coordenadas de números inteiros e ligadas à origem, ${O}(0, 0)$, para formar ${\Delta}OPQ$.
|
||||
|
||||
<img class="img-responsive center-block" alt="a graph plotting points P (x_1, y_1) and Q(x_2, y_2) at integer coordinates that are joined to the origin O (0, 0)" src="https://cdn-media-1.freecodecamp.org/project-euler/right-triangles-integer-coordinates-1.png" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="um gráfico mostrando os pontos P (x_1, y_1) e Q(x_2, y_2) em coordenadas inteiras ligadas à origem O (0, 0)" src="https://cdn-media-1.freecodecamp.org/project-euler/right-triangles-integer-coordinates-1.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
There are exactly fourteen triangles containing a right angle that can be formed when each co-ordinate lies between 0 and 2 inclusive; that is, $0 ≤ x_1, y_1, x_2, y_2 ≤ 2$.
|
||||
Há exatamente catorze triângulos contendo um ângulo reto que podem ser formados quando cada coordenada se encontra entre 0 e 2, ou seja, $0 ≤ x_1, y_1, x_2, y_2 ≤ 2$.
|
||||
|
||||
<img class="img-responsive center-block" alt="a diagram showing the 14 triangles containing a right angle that can be formed when each coordinate is between 0 and 2" src="https://cdn-media-1.freecodecamp.org/project-euler/right-triangles-integer-coordinates-2.png" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="um diagrama mostrando os 14 triângulos contendo um ângulo reto que podem ser formadas quando cada coordenada está entre 0 e 2" src="https://cdn-media-1.freecodecamp.org/project-euler/right-triangles-integer-coordinates-2.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Given that $0 ≤ x_1, y_1, x_2, y_2 ≤ limit$, how many right triangles can be formed?
|
||||
Considerando $0 ≤ x_1, y_1, x_2, y_2 ≤ limit$, quantos triângulos retângulos podem ser formados?
|
||||
|
||||
# --hints--
|
||||
|
||||
`rightTrianglesIntCoords(2)` should return a number.
|
||||
`rightTrianglesIntCoords(2)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof rightTrianglesIntCoords(2) === 'number');
|
||||
```
|
||||
|
||||
`rightTrianglesIntCoords(2)` should return `14`.
|
||||
`rightTrianglesIntCoords(2)` deve retornar `14`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(rightTrianglesIntCoords(2), 14);
|
||||
```
|
||||
|
||||
`rightTrianglesIntCoords(10)` should return `448`.
|
||||
`rightTrianglesIntCoords(10)` deve retornar `448`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(rightTrianglesIntCoords(10), 448);
|
||||
```
|
||||
|
||||
`rightTrianglesIntCoords(25)` should return `3207`.
|
||||
`rightTrianglesIntCoords(25)` deve retornar `3207`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(rightTrianglesIntCoords(25), 3207);
|
||||
```
|
||||
|
||||
`rightTrianglesIntCoords(50)` should return `14234`.
|
||||
`rightTrianglesIntCoords(50)` deve retornar `14234`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(rightTrianglesIntCoords(50), 14234);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3c81000cf542c50fedb
|
||||
title: 'Problem 92: Square digit chains'
|
||||
title: 'Problema 92: Cadeias de algarismos quadrados'
|
||||
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.
|
||||
Uma cadeia de números é criada adicionando continuamente o quadrado dos algarismos em um número para formar um novo número até que ele tenha sido visto antes.
|
||||
|
||||
For example,
|
||||
Por exemplo:
|
||||
|
||||
$$\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.
|
||||
Portanto, qualquer corrente que chegue a 1 ou 89 ficará presa numa repetição infinita. O que é mais incrível é que TODO número inicial eventualmente chegará a 1 ou 89.
|
||||
|
||||
How many starting numbers below `limit` will arrive at 89?
|
||||
Quantos números iniciais abaixo do `limit` chegarão a 89?
|
||||
|
||||
# --hints--
|
||||
|
||||
`squareDigitChains(100)` should return a number.
|
||||
`squareDigitChains(100)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof squareDigitChains(100) === 'number');
|
||||
```
|
||||
|
||||
`squareDigitChains(100)` should return `80`.
|
||||
`squareDigitChains(100)` deve retornar `80`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(squareDigitChains(100), 80);
|
||||
```
|
||||
|
||||
`squareDigitChains(1000)` should return `857`.
|
||||
`squareDigitChains(1000)` deve retornar `857`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(squareDigitChains(1000), 857);
|
||||
```
|
||||
|
||||
`squareDigitChains(100000)` should return `85623`.
|
||||
`squareDigitChains(100000)` deve retornar `85623`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(squareDigitChains(100000), 85623);
|
||||
```
|
||||
|
||||
`squareDigitChains(10000000)` should return `8581146`.
|
||||
`squareDigitChains(10000000)` deve retornar `8581146`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(squareDigitChains(10000000), 8581146);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ca1000cf542c50fedc
|
||||
title: 'Problem 93: Arithmetic expressions'
|
||||
title: 'Problema 93: Expressões aritméticas'
|
||||
challengeType: 5
|
||||
forumTopicId: 302210
|
||||
dashedName: problem-93-arithmetic-expressions
|
||||
@ -8,32 +8,32 @@ dashedName: problem-93-arithmetic-expressions
|
||||
|
||||
# --description--
|
||||
|
||||
By using each of the digits from the set, {1, 2, 3, 4}, exactly once, and making use of the four arithmetic operations (+, −, \*, /) and brackets/parentheses, it is possible to form different positive integer targets.
|
||||
Usando cada um dos algarismos do conjunto {1, 2, 3, 4} exatamente uma vez e fazendo uso das quatro operações aritméticas (+, –, \*, /) e parênteses, é possível formar resultados inteiros positivos diferentes.
|
||||
|
||||
For example,
|
||||
Por exemplo:
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
8 = (4 * (1 + 3)) / 2<br>
|
||||
14 = 4 * (3 + 1 / 2)<br>
|
||||
19 = 4 * (2 + 3) − 1<br>
|
||||
36 = 3 * 4 * (2 + 1)
|
||||
14 = 4 (3 + 1 / 2)<br>
|
||||
19 = 4 * (2 + 3) - 1<br>
|
||||
36 = 3 * 4 (2 + 1)
|
||||
</div>
|
||||
|
||||
Note that concatenations of the digits, like 12 + 34, are not allowed.
|
||||
Observe que as concatenações de algarismos, como 12 + 34, não são permitidas.
|
||||
|
||||
Using the set, {1, 2, 3, 4}, it is possible to obtain thirty-one different target numbers of which 36 is the maximum, and each of the numbers 1 to 28 can be obtained before encountering the first non-expressible number.
|
||||
Usando o conjunto {1, 2, 3, 4}, é possível obter trinta e um resultados numéricos diferentes, dos quais 36 é o máximo. Cada um dos números, de 1 a 28, pode ser obtido antes de encontrar o primeiro número não expressivo.
|
||||
|
||||
Find the set of four distinct digits, `a` < `b` < `c` < `d`, for which the longest set of consecutive positive integers, 1 to `n`, can be obtained, giving your answer as a string: `abcd`.
|
||||
Encontre o conjunto de quatro algarismos distintos, `a` < `b` < `c` < `d`, para os quais o maior conjunto de inteiros positivos consecutivos, de 1 a `n`, pode ser obtido, dando sua resposta como uma string: `abcd`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`arithmeticExpressions()` should return a number.
|
||||
`arithmeticExpressions()` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof arithmeticExpressions() === 'number');
|
||||
```
|
||||
|
||||
`arithmeticExpressions()` should return 1258.
|
||||
`arithmeticExpressions()` deve retornar 1258.
|
||||
|
||||
```js
|
||||
assert.strictEqual(arithmeticExpressions(), 1258);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ca1000cf542c50fedd
|
||||
title: 'Problem 94: Almost equilateral triangles'
|
||||
title: 'Problema 94: Triângulos quase equiláteros'
|
||||
challengeType: 5
|
||||
forumTopicId: 302211
|
||||
dashedName: problem-94-almost-equilateral-triangles
|
||||
@ -8,39 +8,39 @@ dashedName: problem-94-almost-equilateral-triangles
|
||||
|
||||
# --description--
|
||||
|
||||
It is easily proved that no equilateral triangle exists with integral length sides and integral area. However, the almost equilateral triangle 5-5-6 has an area of 12 square units.
|
||||
Pode-se provar facilmente que não existe nenhum triângulo equilátero com lados de comprimento de números inteiros e área de números inteiros. No entanto, o triângulo quase equilátero 5-5-6 tem uma área de 12 unidades quadradas.
|
||||
|
||||
We shall define an <dfn>almost equilateral triangle</dfn> to be a triangle for which two sides are equal and the third differs by no more than one unit.
|
||||
Devemos definir um <dfn>triângulo quase equilátero</dfn> seja um triângulo para os quais dois lados são iguais e o terceiro é, no máximo, uma unidade maior ou menor.
|
||||
|
||||
Find the sum of the perimeters of all almost equilateral triangles with integral side lengths and area and whose perimeters do not exceed `limit`.
|
||||
Encontre a soma dos perímetros de todos os triângulos quase equiláteros com comprimento dos lados e área compostos de números inteiros e cujos perímetros não excedam `limit`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`almostEquilateralTriangles(50)` should return a number.
|
||||
`almostEquilateralTriangles(50)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof almostEquilateralTriangles(50) === 'number');
|
||||
```
|
||||
|
||||
`almostEquilateralTriangles(50)` should return `66`.
|
||||
`almostEquilateralTriangles(50)` deve retornar `66`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(almostEquilateralTriangles(50), 66);
|
||||
```
|
||||
|
||||
`almostEquilateralTriangles(10000)` should return `3688`.
|
||||
`almostEquilateralTriangles(10000)` deve retornar `3688`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(almostEquilateralTriangles(10000), 3688);
|
||||
```
|
||||
|
||||
`almostEquilateralTriangles(10000000)` should return `9973078`.
|
||||
`almostEquilateralTriangles(10000000)` deve retornar `9973078`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(almostEquilateralTriangles(10000000), 9973078);
|
||||
```
|
||||
|
||||
`almostEquilateralTriangles(1000000000)` should return `518408346`.
|
||||
`almostEquilateralTriangles(1000000000)` deve retornar `518408346`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(almostEquilateralTriangles(1000000000), 518408346);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3d01000cf542c50fee2
|
||||
title: 'Problem 99: Largest exponential'
|
||||
title: 'Problema 99: Maior exponencial'
|
||||
challengeType: 5
|
||||
forumTopicId: 302216
|
||||
dashedName: problem-99-largest-exponential
|
||||
@ -8,27 +8,27 @@ dashedName: problem-99-largest-exponential
|
||||
|
||||
# --description--
|
||||
|
||||
Comparing two numbers written in index form like $2^{11}$ and $3^7$ is not difficult, as any calculator would confirm that $2^{11} = 2048 < 3^7 = 2187$.
|
||||
Comparar dois números escritos em forma de índice como $2^{11}$ e $3^7$ não é difícil, como uma calculadora confirmaria que $2^{11} = 2048 < 3^7 = 2187$.
|
||||
|
||||
However, confirming that $632382^{518061} < 519432^{525806}$ would be much more difficult, as both numbers contain over three million digits.
|
||||
No entanto, confirmar que $632382^{518061} < 519432^{525806}$ seria muito mais difícil, já que ambos os números contêm mais de três milhões de dígitos.
|
||||
|
||||
Using the 2D `baseExp` array of base/exponent pairs, determine pair with the greatest numerical value and return it.
|
||||
Usando o array bidimensional `baseExp` de pares base/expoente, determine par com o maior valor numérico e retorne-o.
|
||||
|
||||
# --hints--
|
||||
|
||||
`largestExponential(testArray1)` should return an array.
|
||||
`largestExponential(testArray1)` deve retornar um array.
|
||||
|
||||
```js
|
||||
assert(Array.isArray(largestExponential(_testArray1)));
|
||||
```
|
||||
|
||||
`largestExponential(testArray1)` should return `[840237, 507276]`.
|
||||
`largestExponential(testArray1)` deve retornar `[840237, 507276]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(largestExponential(_testArray1), [840237, 507276]);
|
||||
```
|
||||
|
||||
`largestExponential(testArray2)` should return `[895447, 504922]`.
|
||||
`largestExponential(testArray2)` deve retornar `[895447, 504922]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(largestExponential(_testArray2), [895447, 504922]);
|
||||
|
Reference in New Issue
Block a user