Files
freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-477-number-sequence-game.chinese.md
Oliver Eyton-Williams 61460c8601 fix: insert blank line after ```
search and replace ```\n< with ```\n\n< to ensure there's an empty line
before closing tags
2020-08-16 04:45:20 +05:30

1.6 KiB
Raw Blame History

id, challengeType, title, videoUrl, localeTitle
id challengeType title videoUrl localeTitle
5900f54a1000cf542c51005c 5 Problem 477: Number Sequence Game 问题477数字序列游戏

Description

数字序列游戏以写在一行上的N个数字的序列S开始。两名球员交替轮流。在轮到他时玩家必须选择并删除序列中剩余的第一个或最后一个数字。球员得分是他所取得的所有数字的总和。每个玩家都试图最大化自己的总和。如果N = 4并且S = {1,2,10,3}则每个玩家最大化他的得分如下玩家1移除第一个数字1玩家2从剩余序列移除最后一个数字3玩家1从剩余序列中移除最后一个号码10玩家2移除剩余号码2玩家1得分为1 + 10 = 11.如果两个玩家都遵循则FN为玩家1的得分序列的最优策略S = {s1s2...sN}定义为s1 = 0 si + 1 =si2 + 45modulo 1 000 000 007序列以S = {0,45,2070开头4284945,753524550,478107844,894218625...}。给出F2= 45F4= 4284990F100= 26365463243F104= 2495838522951。求F108

Instructions

Tests

tests:
  - text: <code>euler477()</code>应该返回25044905874565164。
    testString: assert.strictEqual(euler477(), 25044905874565164);

Challenge Seed

function euler477() {
  // Good luck!
  return true;
}

euler477();

Solution

// solution required

/section>