freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-336-maximix-arrange...

30 lines
1.4 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
id: 5900f4bd1000cf542c50ffcf
title: 问题336Maximix安排
challengeType: 5
videoUrl: ''
---
# --description--
一列火车用于按顺序运输四辆车ABCD。然而有时当火车到达收集车厢时它们的顺序不正确。为了重新安排车厢他们都被分流到一个大型旋转转盘上。在车厢在特定点处脱开之后列车从转盘上移开拉动仍与其连接的托架。其余的车厢旋转180度。然后重新加入所有托架并且根据需要重复该过程以便获得转盘的最少使用次数。一些布置例如ADCB可以很容易地解决托架在A和D之间分开并且在DCB旋转之后已经实现了正确的顺序。
然而火车司机简单西蒙并不知道他的效率所以他总是通过最初将马车A放在正确的位置然后是马车B等来解决问题。
使用四个车厢西蒙的最坏可能安排是DACB和DBAC我们称之为maximix安排。每个都需要他五次旋转尽管使用最有效的方法他们可以使用三次旋转来解决。他用于DACB的过程如下所示。
可以证实对于六个车厢存在24个最大值布置其中第十个词典最大化布置是DFAECB。
查找11种车厢的第11版词典格式。
# --hints--
`euler336()`应该返回CAGBIHEFJDK。
```js
assert.strictEqual(euler336(), CAGBIHEFJDK);
```
# --solutions--