mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-09 01:11:42 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>共有 <code>n</code> 名小伙伴一起做游戏。小伙伴们围成一圈,按 <strong>顺时针顺序</strong> 从 <code>1</code> 到 <code>n</code> 编号。确切地说,从第 <code>i</code> 名小伙伴顺时针移动一位会到达第 <code>(i+1)</code> 名小伙伴的位置,其中 <code>1 <= i < n</code> ,从第 <code>n</code> 名小伙伴顺时针移动一位会回到第 <code>1</code> 名小伙伴的位置。</p>\n\n<p>游戏遵循如下规则:</p>\n\n<ol>\n\t<li>从第 <code>1</code> 名小伙伴所在位置 <strong>开始</strong> 。</li>\n\t<li>沿着顺时针方向数 <code>k</code> 名小伙伴,计数时需要 <strong>包含</strong> 起始时的那位小伙伴。逐个绕圈进行计数,一些小伙伴可能会被数过不止一次。</li>\n\t<li>你数到的最后一名小伙伴需要离开圈子,并视作输掉游戏。</li>\n\t<li>如果圈子中仍然有不止一名小伙伴,从刚刚输掉的小伙伴的 <strong>顺时针下一位</strong> 小伙伴 <strong>开始</strong>,回到步骤 <code>2</code> 继续执行。</li>\n\t<li>否则,圈子中最后一名小伙伴赢得游戏。</li>\n</ol>\n\n<p>给你参与游戏的小伙伴总数 <code>n</code> ,和一个整数 <code>k</code> ,返回游戏的获胜者。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/03/25/ic234-q2-ex11.png\" style=\"width: 500px; height: 345px;\" />\n<pre>\n<strong>输入:</strong>n = 5, k = 2\n<strong>输出:</strong>3\n<strong>解释:</strong>游戏运行步骤如下:\n1) 从小伙伴 1 开始。\n2) 顺时针数 2 名小伙伴,也就是小伙伴 1 和 2 。\n3) 小伙伴 2 离开圈子。下一次从小伙伴 3 开始。\n4) 顺时针数 2 名小伙伴,也就是小伙伴 3 和 4 。\n5) 小伙伴 4 离开圈子。下一次从小伙伴 5 开始。\n6) 顺时针数 2 名小伙伴,也就是小伙伴 5 和 1 。\n7) 小伙伴 1 离开圈子。下一次从小伙伴 3 开始。\n8) 顺时针数 2 名小伙伴,也就是小伙伴 3 和 5 。\n9) 小伙伴 5 离开圈子。只剩下小伙伴 3 。所以小伙伴 3 是游戏的获胜者。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 6, k = 5\n<strong>输出:</strong>1\n<strong>解释:</strong>小伙伴离开圈子的顺序:5、4、6、2、3 。小伙伴 1 是游戏的获胜者。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= k <= n <= 500</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 42,
|
||||
"likes": 46,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"12.6K\", \"totalSubmission\": \"17.3K\", \"totalAcceptedRaw\": 12580, \"totalSubmissionRaw\": 17280, \"acRate\": \"72.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"13.5K\", \"totalSubmission\": \"18.5K\", \"totalAcceptedRaw\": 13454, \"totalSubmissionRaw\": 18486, \"acRate\": \"72.8%\"}",
|
||||
"hints": [
|
||||
"Simulate the process.",
|
||||
"Maintain in a circular list the people who are still in the circle and the current person you are standing at.",
|
||||
|
Reference in New Issue
Block a user