chore(i8n,learn): processed translations

This commit is contained in:
Crowdin Bot
2021-02-06 04:42:36 +00:00
committed by Mrugesh Mohapatra
parent 15047f2d90
commit e5c44a3ae5
3274 changed files with 172122 additions and 14164 deletions

View File

@ -1,45 +1,66 @@
---
id: 5951e88f64ebf159166a1176
title: 24场比赛
title: 24 game
challengeType: 5
videoUrl: ''
forumTopicId: 302218
dashedName: 24-game
---
# --description--
<p>实现一个以四位数字串为参数的函数每个数字从1──►9允许重复并返回一个算术表达式其值为24。如果不存在这样的解则返回“没有解决方案。“ </p><p>规则: </p>只允许以下运算符/函数:乘法,除法,加法,减法除法应使用浮点或有理算术等来保留余数。不允许从提供的数字中形成多位数字。 所以当给出1,2,2和1时12 + 12的答案是错误的。给定的数字顺序不必保留。 <p>示例输入: </p> <code>solve24("4878");</code> <code>solve24("1234");</code> <code>solve24("6789");</code> <code>solve24("1127");</code> <p>示例输出(字符串): </p> <code>(7-8/8)\*4</code> <code>3\*1\*4\*2</code> <code>(6\*8)/(9-7)</code> <code>(1+7)\*(2+1)</code>
The [24 Game](https://en.wikipedia.org/wiki/24_Game) tests a person's mental arithmetic.
The aim of the game is to arrange four numbers in a way that when evaluated, the result is 24
# --instructions--
Implement a function that takes a string of four digits as its argument, with each digit from 1 to 9 (inclusive) with repetitions allowed, and returns an arithmetic expression that evaluates to the number 24. If no such solution exists, return "no solution exists".
**Rules:**
<ul>
<li> Only the following operators/functions are allowed: multiplication, division, addition, subtraction. </li>
<li> Division should use floating point or rational arithmetic, etc, to preserve remainders. </li>
<li> Forming multiple digit numbers from the supplied digits is disallowed. (So an answer of 12+12 when given 1, 2, 2, and 1 is wrong). </li>
<li> The order of the digits when given does not have to be preserved. </li>
</ul>
| Example input | Example output |
| ------------------------- | ------------------------- |
| <code>solve24("4878");</code> | <code>(7-8/8)\*4</code> |
| <code>solve24("1234");</code> | <code>3\*1\*4\*2</code> |
| <code>solve24("6789");</code> | <code>(6\*8)/(9-7)</code> |
| <code>solve24("1127");</code> | <code>(1+7)\*(2+1)</code> |
# --hints--
`solve24`是一个函数。
`solve24` should be a function.
```js
assert(typeof solve24 === 'function');
```
`solve24("4878")`应返回`(7-8/8)*4``4*(7-8/8)`
`solve24("4878")` should return `(7-8/8)*4` or `4*(7-8/8)`
```js
assert(include(answers[0], solve24(testCases[0])));
assert(include(answers[0], removeParentheses(solve24(testCases[0]))));
```
`solve24("1234")`应返回`1*2*3*4`任何排列
`solve24("1234")` should return any arrangement of `1*2*3*4`
```js
assert(include(answers[1], solve24(testCases[1])));
assert(include(answers[1], removeParentheses(solve24(testCases[1]))));
```
`solve24("6789")`应返回`(6*8)/(9-7)``(8*6)/(9-7)`
`solve24("6789")` should return `(6*8)/(9-7)` or `(8*6)/(9-7)`
```js
assert(include(answers[2], solve24(testCases[2])));
assert(include(answers[2], removeParentheses(solve24(testCases[2]))));
```
`solve24("1127")`应该返回`(1+7)*(1*2)`的排列
`solve24("1127")` should return a permutation of `(1+7)*(1+2)`
```js
assert(include(answers[3], solve24(testCases[3])));
assert(include(answers[3], removeParentheses(solve24(testCases[3]))));
```
# --seed--