Files
freeCodeCamp/curriculum/challenges/japanese/10-coding-interview-prep/project-euler/problem-93-arithmetic-expressions.md
2022-01-20 20:30:18 +01:00

60 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 5900f3ca1000cf542c50fedc
title: '問題 93: 算術式'
challengeType: 5
forumTopicId: 302210
dashedName: problem-93-arithmetic-expressions
---
# --description--
集合 {1, 2, 3, 4} の数字をそれぞれちょうど 1 回ずつ使用し、また四則演算 (+、 -、\*、/) と括弧を使用して、それぞれ異なる正の整数を作ることができます。
例えば次のようになります。
<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)
</div>
12 + 34 のように数字を連結することは許可されないので注意してください。
集合 {1, 2, 3, 4} を使用すると、31 個の異なる数が得られ (そのうち最大の数は 36)、表現不能な数に初めて遭遇するまでに 1 から 28 までのそれぞれの数が得られます。
1 から `n` までの連続した正の整数の最長の集合が得られるような、4 つの相異なる数字の集合 `a` &lt; `b` &lt; `c` &lt; `d` を求め、文字列 `abcd` として答えなさい。
# --hints--
`arithmeticExpressions()` は数値を返す必要があります。
```js
assert(typeof arithmeticExpressions() === 'number');
```
`arithmeticExpressions()` は 1258 を返す必要があります。
```js
assert.strictEqual(arithmeticExpressions(), 1258);
```
# --seed--
## --seed-contents--
```js
function arithmeticExpressions() {
return true;
}
arithmeticExpressions();
```
# --solutions--
```js
// solution required
```