1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-24 14:28:56 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>几块石子 <strong>排成一行</strong> ,每块石子都有一个关联值,关联值为整数,由数组 <code>stoneValue</code> 给出。</p>\n\n<p>游戏中的每一轮Alice 会将这行石子分成两个 <strong>非空行</strong>左侧行和右侧行Bob 负责计算每一行的值即此行中所有石子的值的总和。Bob 会丢弃值最大的行Alice 的得分为剩下那行的值每轮累加。如果两行的值相等Bob 让 Alice 决定丢弃哪一行。下一轮从剩下的那一行开始。</p>\n\n<p>只 <strong>剩下一块石子</strong> 时游戏结束。Alice 的分数最初为 <strong><code>0</code></strong> 。</p>\n\n<p>返回 <strong>Alice 能够获得的最大分数</strong><em> 。</em></p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><strong>输入:</strong>stoneValue = [6,2,3,4,5,5]\n<strong>输出:</strong>18\n<strong>解释:</strong>在第一轮中Alice 将行划分为 [623][455] 。左行的值是 11 ,右行的值是 14 。Bob 丢弃了右行Alice 的分数现在是 11 。\n在第二轮中Alice 将行分成 [6][23] 。这一次 Bob 扔掉了左行Alice 的分数变成了 1611 + 5。\n最后一轮 Alice 只能将行分成 [2][3] 。Bob 扔掉右行Alice 的分数现在是 1816 + 2。游戏结束因为这行只剩下一块石头了。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>stoneValue = [7,7,7,7,7,7,7]\n<strong>输出:</strong>28\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><strong>输入:</strong>stoneValue = [4]\n<strong>输出:</strong>0\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= stoneValue.length &lt;= 500</code></li>\n\t<li><code>1 &lt;=&nbsp;stoneValue[i] &lt;= 10^6</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 43,
"likes": 45,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"4.5K\", \"totalSubmission\": \"11.5K\", \"totalAcceptedRaw\": 4467, \"totalSubmissionRaw\": 11498, \"acRate\": \"38.9%\"}",
"stats": "{\"totalAccepted\": \"4.5K\", \"totalSubmission\": \"11.7K\", \"totalAcceptedRaw\": 4531, \"totalSubmissionRaw\": 11657, \"acRate\": \"38.9%\"}",
"hints": [
"We need to try all possible divisions for the current row to get the max score.",
"As calculating all possible divisions will lead us to calculate some sub-problems more than once, we need to think of dynamic programming."