mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-07 00:11:41 +08:00
移除零宽空格
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
"boundTopicId": 591898,
|
||||
"title": "Maximum Score From Removing Stones",
|
||||
"titleSlug": "maximum-score-from-removing-stones",
|
||||
"content": "<p>You are playing a solitaire game with <strong>three piles</strong> of stones of sizes <code>a</code>, <code>b</code>, and <code>c</code> respectively. Each turn you choose two <strong>different non-empty </strong>piles, take one stone from each, and add <code>1</code> point to your score. The game stops when there are <strong>fewer than two non-empty</strong> piles (meaning there are no more available moves).</p>\n\n<p>Given three integers <code>a</code>, <code>b</code>, and <code>c</code>, return <em>the</em> <strong><em>maximum</em> </strong><em><strong>score</strong> you can get.</em></p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> a = 2, b = 4, c = 6\n<strong>Output:</strong> 6\n<strong>Explanation:</strong> The starting state is (2, 4, 6). One optimal set of moves is:\n- Take from 1st and 3rd piles, state is now (1, 4, 5)\n- Take from 1st and 3rd piles, state is now (0, 4, 4)\n- Take from 2nd and 3rd piles, state is now (0, 3, 3)\n- Take from 2nd and 3rd piles, state is now (0, 2, 2)\n- Take from 2nd and 3rd piles, state is now (0, 1, 1)\n- Take from 2nd and 3rd piles, state is now (0, 0, 0)\nThere are fewer than two non-empty piles, so the game ends. Total: 6 points.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> a = 4, b = 4, c = 6\n<strong>Output:</strong> 7\n<strong>Explanation:</strong> The starting state is (4, 4, 6). One optimal set of moves is:\n- Take from 1st and 2nd piles, state is now (3, 3, 6)\n- Take from 1st and 3rd piles, state is now (2, 3, 5)\n- Take from 1st and 3rd piles, state is now (1, 3, 4)\n- Take from 1st and 3rd piles, state is now (0, 3, 3)\n- Take from 2nd and 3rd piles, state is now (0, 2, 2)\n- Take from 2nd and 3rd piles, state is now (0, 1, 1)\n- Take from 2nd and 3rd piles, state is now (0, 0, 0)\nThere are fewer than two non-empty piles, so the game ends. Total: 7 points.\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> a = 1, b = 8, c = 8\n<strong>Output:</strong> 8\n<strong>Explanation:</strong> One optimal set of moves is to take from the 2nd and 3rd piles for 8 turns until they are empty.\nAfter that, there are fewer than two non-empty piles, so the game ends.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= a, b, c <= 10<sup>5</sup></code></li>\n</ul>\n",
|
||||
"content": "<p>You are playing a solitaire game with <strong>three piles</strong> of stones of sizes <code>a</code>, <code>b</code>, and <code>c</code> respectively. Each turn you choose two <strong>different non-empty </strong>piles, take one stone from each, and add <code>1</code> point to your score. The game stops when there are <strong>fewer than two non-empty</strong> piles (meaning there are no more available moves).</p>\n\n<p>Given three integers <code>a</code>, <code>b</code>, and <code>c</code>, return <em>the</em> <strong><em>maximum</em> </strong><em><strong>score</strong> you can get.</em></p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> a = 2, b = 4, c = 6\n<strong>Output:</strong> 6\n<strong>Explanation:</strong> The starting state is (2, 4, 6). One optimal set of moves is:\n- Take from 1st and 3rd piles, state is now (1, 4, 5)\n- Take from 1st and 3rd piles, state is now (0, 4, 4)\n- Take from 2nd and 3rd piles, state is now (0, 3, 3)\n- Take from 2nd and 3rd piles, state is now (0, 2, 2)\n- Take from 2nd and 3rd piles, state is now (0, 1, 1)\n- Take from 2nd and 3rd piles, state is now (0, 0, 0)\nThere are fewer than two non-empty piles, so the game ends. Total: 6 points.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> a = 4, b = 4, c = 6\n<strong>Output:</strong> 7\n<strong>Explanation:</strong> The starting state is (4, 4, 6). One optimal set of moves is:\n- Take from 1st and 2nd piles, state is now (3, 3, 6)\n- Take from 1st and 3rd piles, state is now (2, 3, 5)\n- Take from 1st and 3rd piles, state is now (1, 3, 4)\n- Take from 1st and 3rd piles, state is now (0, 3, 3)\n- Take from 2nd and 3rd piles, state is now (0, 2, 2)\n- Take from 2nd and 3rd piles, state is now (0, 1, 1)\n- Take from 2nd and 3rd piles, state is now (0, 0, 0)\nThere are fewer than two non-empty piles, so the game ends. Total: 7 points.\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> a = 1, b = 8, c = 8\n<strong>Output:</strong> 8\n<strong>Explanation:</strong> One optimal set of moves is to take from the 2nd and 3rd piles for 8 turns until they are empty.\nAfter that, there are fewer than two non-empty piles, so the game ends.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= a, b, c <= 10<sup>5</sup></code></li>\n</ul>\n",
|
||||
"translatedTitle": "移除石子的最大得分",
|
||||
"translatedContent": "<p>你正在玩一个单人游戏,面前放置着大小分别为 <code>a</code>、<code>b</code> 和 <code>c</code> 的 <strong>三堆</strong> 石子。</p>\n\n<p>每回合你都要从两个 <strong>不同的非空堆</strong> 中取出一颗石子,并在得分上加 <code>1</code> 分。当存在 <strong>两个或更多</strong> 的空堆时,游戏停止。</p>\n\n<p>给你三个整数 <code>a</code> 、<code>b</code> 和 <code>c</code> ,返回可以得到的 <strong>最大分数</strong> 。</p>\n \n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>a = 2, b = 4, c = 6\n<strong>输出:</strong>6\n<strong>解释:</strong>石子起始状态是 (2, 4, 6) ,最优的一组操作是:\n- 从第一和第三堆取,石子状态现在是 (1, 4, 5)\n- 从第一和第三堆取,石子状态现在是 (0, 4, 4)\n- 从第二和第三堆取,石子状态现在是 (0, 3, 3)\n- 从第二和第三堆取,石子状态现在是 (0, 2, 2)\n- 从第二和第三堆取,石子状态现在是 (0, 1, 1)\n- 从第二和第三堆取,石子状态现在是 (0, 0, 0)\n总分:6 分 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>a = 4, b = 4, c = 6\n<strong>输出:</strong>7\n<strong>解释:</strong>石子起始状态是 (4, 4, 6) ,最优的一组操作是:\n- 从第一和第二堆取,石子状态现在是 (3, 3, 6)\n- 从第一和第三堆取,石子状态现在是 (2, 3, 5)\n- 从第一和第三堆取,石子状态现在是 (1, 3, 4)\n- 从第一和第三堆取,石子状态现在是 (0, 3, 3)\n- 从第二和第三堆取,石子状态现在是 (0, 2, 2)\n- 从第二和第三堆取,石子状态现在是 (0, 1, 1)\n- 从第二和第三堆取,石子状态现在是 (0, 0, 0)\n总分:7 分 。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>a = 1, b = 8, c = 8\n<strong>输出:</strong>8\n<strong>解释:</strong>最优的一组操作是连续从第二和第三堆取 8 回合,直到将它们取空。\n注意,由于第二和第三堆已经空了,游戏结束,不能继续从第一堆中取石子。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= a, b, c <= 10<sup>5</sup></code></li>\n</ul>\n",
|
||||
"translatedContent": "<p>你正在玩一个单人游戏,面前放置着大小分别为 <code>a</code>、<code>b</code> 和 <code>c</code> 的 <strong>三堆</strong> 石子。</p>\n\n<p>每回合你都要从两个 <strong>不同的非空堆</strong> 中取出一颗石子,并在得分上加 <code>1</code> 分。当存在 <strong>两个或更多</strong> 的空堆时,游戏停止。</p>\n\n<p>给你三个整数 <code>a</code> 、<code>b</code> 和 <code>c</code> ,返回可以得到的 <strong>最大分数</strong> 。</p>\n \n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>a = 2, b = 4, c = 6\n<strong>输出:</strong>6\n<strong>解释:</strong>石子起始状态是 (2, 4, 6) ,最优的一组操作是:\n- 从第一和第三堆取,石子状态现在是 (1, 4, 5)\n- 从第一和第三堆取,石子状态现在是 (0, 4, 4)\n- 从第二和第三堆取,石子状态现在是 (0, 3, 3)\n- 从第二和第三堆取,石子状态现在是 (0, 2, 2)\n- 从第二和第三堆取,石子状态现在是 (0, 1, 1)\n- 从第二和第三堆取,石子状态现在是 (0, 0, 0)\n总分:6 分 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>a = 4, b = 4, c = 6\n<strong>输出:</strong>7\n<strong>解释:</strong>石子起始状态是 (4, 4, 6) ,最优的一组操作是:\n- 从第一和第二堆取,石子状态现在是 (3, 3, 6)\n- 从第一和第三堆取,石子状态现在是 (2, 3, 5)\n- 从第一和第三堆取,石子状态现在是 (1, 3, 4)\n- 从第一和第三堆取,石子状态现在是 (0, 3, 3)\n- 从第二和第三堆取,石子状态现在是 (0, 2, 2)\n- 从第二和第三堆取,石子状态现在是 (0, 1, 1)\n- 从第二和第三堆取,石子状态现在是 (0, 0, 0)\n总分:7 分 。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>a = 1, b = 8, c = 8\n<strong>输出:</strong>8\n<strong>解释:</strong>最优的一组操作是连续从第二和第三堆取 8 回合,直到将它们取空。\n注意,由于第二和第三堆已经空了,游戏结束,不能继续从第一堆中取石子。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= a, b, c <= 10<sup>5</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 111,
|
||||
|
Reference in New Issue
Block a user