Files
freeCodeCamp/curriculum/challenges/japanese/10-coding-interview-prep/project-euler/problem-185-number-mind.md
2022-04-02 17:46:30 +09:00

67 lines
2.6 KiB
Markdown

---
id: 5900f4251000cf542c50ff38
title: '問題 185: ナンバーマインド'
challengeType: 5
forumTopicId: 301821
dashedName: problem-185-number-mind
---
# --description--
ナンバーマインドというゲームは、有名なゲームであるマスターマインドの変形版です。
マスターマインドで使う色付きピンの代わりに、秘密の数列を推理します。 推理するたびに、推理どおりの桁がいくつあったかだけを知らされます。 つまり、数列が 1234 で、あなたが 2036 と推理したら、1 桁だけ合っていることが知らされます。しかし、数字は合っているが桁の位置が違うという情報は教えてもらえません。
例えば、5 桁の秘密の数列について次の推理が与えられます。
$$\begin{align} & 90342 ;2\\;\text{個正しい}\\\\
& 70794 ;0\\;\text{個正しい}\\\\ & 39458 ;2\\;\text{個正しい}\\\\
& 34109 ;1\\;\text{個正しい}\\\\ & 51545 ;2\\;\text{個正しい}\\\\
& 12531 ;1\\;\text{個正しい} \end{align}$$
正解の数列は 39542 だけです。
次の推理が与えられたとします。
$$\begin{align} & 5616185650518293 ;2\\;\text{個正しい}\\\\
& 3847439647293047 ;1\\;\text{個正しい}\\\\ & 5855462940810587 ;3\\;\text{個正しい}\\\\
& 9742855507068353 ;3\\;\text{個正しい}\\\\ & 4296849643607543 ;3\\;\text{個正しい}\\\\
& 3174248439465858 ;1\\;\text{個正しい}\\\\ & 4513559094146117 ;2\\;\text{個正しい}\\\\
& 7890971548908067 ;3\\;\text{個正しい}\\\\ & 8157356344118483 ;1\\;\text{個正しい}\\\\
& 2615250744386899 ;2\\;\text{個正しい}\\\\ & 8690095851526254 ;3\\;\text{個正しい}\\\\
& 6375711915077050 ;1\\;\text{個正しい}\\\\ & 6913859173121360 ;1\\;\text{個正しい}\\\\
& 6442889055042768 ;2\\;\text{個正しい}\\\\ & 2321386104303845 ;0\\;\text{個正しい}\\\\
& 2326509471271448 ;2\\;\text{個正しい}\\\\ & 5251583379644322 ;2\\;\text{個正しい}\\\\
& 1748270476758276 ;3\\;\text{個正しい}\\\\ & 4895722652190306 ;1\\;\text{個正しい}\\\\
& 3041631117224635 ;3\\;\text{個正しい}\\\\ & 1841236454324589 ;3\\;\text{個正しい}\\\\
& 2659862637316867 ;2\\;\text{個正しい} \end{align}$$
これらに基づき、唯一の正解である 16 桁の数列を求めなさい。
# --hints--
`numberMind()``4640261571849533` を返す必要があります。
```js
assert.strictEqual(numberMind(), 4640261571849533);
```
# --seed--
## --seed-contents--
```js
function numberMind() {
return true;
}
numberMind();
```
# --solutions--
```js
// solution required
```