1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-24 22:38:57 +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>Alice 和 Bob 两个人轮流玩一个游戏Alice 先手。</p>\n\n<p>一开始,有 <code>n</code>&nbsp;个石子堆在一起。每个人轮流操作,正在操作的玩家可以从石子堆里拿走 <strong>任意</strong>&nbsp;非零 <strong>平方数</strong>&nbsp;个石子。</p>\n\n<p>如果石子堆里没有石子了,则无法操作的玩家输掉游戏。</p>\n\n<p>给你正整数&nbsp;<code>n</code>&nbsp;,且已知两个人都采取最优策略。如果 Alice 会赢得比赛,那么返回&nbsp;<code>True</code>&nbsp;,否则返回&nbsp;<code>False</code>&nbsp;。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 1\n<strong>输出:</strong>true\n<strong>解释:</strong>Alice 拿走 1 个石子并赢得胜利,因为 Bob 无法进行任何操作。</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 2\n<strong>输出:</strong>false\n<strong>解释:</strong>Alice 只能拿走 1 个石子,然后 Bob 拿走最后一个石子并赢得胜利2 -&gt; 1 -&gt; 0。</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 4\n<strong>输出:</strong>true\n<strong>解释:</strong>n 已经是一个平方数Alice 可以一次全拿掉 4 个石子并赢得胜利4 -&gt; 0。\n</pre>\n\n<p><strong>示例 4</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 7\n<strong>输出:</strong>false\n<strong>解释:</strong>当 Bob 采取最优策略时Alice 无法赢得比赛。\n如果 Alice 一开始拿走 4 个石子, Bob 会拿走 1 个石子,然后 Alice 只能拿走 1 个石子Bob 拿走最后一个石子并赢得胜利7 -&gt; 3 -&gt; 2 -&gt; 1 -&gt; 0。\n如果 Alice 一开始拿走 1 个石子, Bob 会拿走 4 个石子,然后 Alice 只能拿走 1 个石子Bob 拿走最后一个石子并赢得胜利7 -&gt; 6 -&gt; 2 -&gt; 1 -&gt; 0。</pre>\n\n<p><strong>示例 5</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 17\n<strong>输出:</strong>false\n<strong>解释:</strong>如果 Bob 采取最优策略Alice 无法赢得胜利。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= n &lt;= 10^5</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 41,
"likes": 43,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,13 +149,13 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"6.1K\", \"totalSubmission\": \"10.3K\", \"totalAcceptedRaw\": 6073, \"totalSubmissionRaw\": 10318, \"acRate\": \"58.9%\"}",
"stats": "{\"totalAccepted\": \"6.2K\", \"totalSubmission\": \"10.5K\", \"totalAcceptedRaw\": 6224, \"totalSubmissionRaw\": 10542, \"acRate\": \"59.0%\"}",
"hints": [
"Use dynamic programming to keep track of winning and losing states. Given some number of stones, Alice can win if she can force Bob onto a losing state."
],
"solution": null,
"status": null,
"sampleTestCase": "1",
"sampleTestCase": "1\r",
"metaData": "{\n \"name\": \"winnerSquareGame\",\n \"params\": [\n {\n \"name\": \"n\",\n \"type\": \"integer\"\n }\n ],\n \"return\": {\n \"type\": \"boolean\"\n }\n}",
"judgerAvailable": true,
"judgeType": "large",