mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 22:13:28 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>现有一份 <code>n + m</code> 次投掷单个<strong> 六面</strong> 骰子的观测数据,骰子的每个面从 <code>1</code> 到 <code>6</code> 编号。观测数据中缺失了 <code>n</code> 份,你手上只拿到剩余 <code>m</code> 次投掷的数据。幸好你有之前计算过的这 <code>n + m</code> 次投掷数据的 <strong>平均值</strong> 。</p>\n\n<p>给你一个长度为 <code>m</code> 的整数数组 <code>rolls</code> ,其中 <code>rolls[i]</code> 是第 <code>i</code> 次观测的值。同时给你两个整数 <code>mean</code> 和 <code>n</code> 。</p>\n\n<p>返回一个长度为<em> </em><code>n</code><em> </em>的数组,包含所有缺失的观测数据,且满足这<em> </em><code>n + m</code><em> </em>次投掷的 <strong>平均值</strong> 是<em> </em><code>mean</code> 。如果存在多组符合要求的答案,只需要返回其中任意一组即可。如果不存在答案,返回一个空数组。</p>\n\n<p><code>k</code> 个数字的 <strong>平均值</strong> 为这些数字求和后再除以 <code>k</code> 。</p>\n\n<p>注意 <code>mean</code> 是一个整数,所以 <code>n + m</code> 次投掷的总和需要被 <code>n + m</code> 整除。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>rolls = [3,2,4,3], mean = 4, n = 2\n<strong>输出:</strong>[6,6]\n<strong>解释:</strong>所有 n + m 次投掷的平均值是 (3 + 2 + 4 + 3 + 6 + 6) / 6 = 4 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>rolls = [1,5,6], mean = 3, n = 4\n<strong>输出:</strong>[2,3,2,2]\n<strong>解释:</strong>所有 n + m 次投掷的平均值是 (1 + 5 + 6 + 2 + 3 + 2 + 2) / 7 = 3 。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>rolls = [1,2,3,4], mean = 6, n = 4\n<strong>输出:</strong>[]\n<strong>解释:</strong>无论丢失的 4 次数据是什么,平均值都不可能是 6 。\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<strong>输入:</strong>rolls = [1], mean = 3, n = 1\n<strong>输出:</strong>[5]\n<strong>解释:</strong>所有 n + m 次投掷的平均值是 (1 + 5) / 2 = 3 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>m == rolls.length</code></li>\n\t<li><code>1 <= n, m <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= rolls[i], mean <= 6</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 65,
|
||||
"likes": 67,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"31.8K\", \"totalSubmission\": \"62.8K\", \"totalAcceptedRaw\": 31794, \"totalSubmissionRaw\": 62806, \"acRate\": \"50.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"32.7K\", \"totalSubmission\": \"64.6K\", \"totalAcceptedRaw\": 32735, \"totalSubmissionRaw\": 64616, \"acRate\": \"50.7%\"}",
|
||||
"hints": [
|
||||
"What should the sum of the n rolls be?",
|
||||
"Could you generate an array of size n such that each element is between 1 and 6?"
|
||||
|
Reference in New Issue
Block a user