mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
29 lines
1.1 KiB
HTML
29 lines
1.1 KiB
HTML
|
<p>Given an integer array <code>nums</code> of <strong>positive</strong> integers, return <em>the average value of all even integers that are divisible by</em> <code>3</code><i>.</i></p>
|
||
|
|
||
|
<p>Note that the <strong>average</strong> of <code>n</code> elements is the <strong>sum</strong> of the <code>n</code> elements divided by <code>n</code> and <strong>rounded down</strong> to the nearest integer.</p>
|
||
|
|
||
|
<p> </p>
|
||
|
<p><strong class="example">Example 1:</strong></p>
|
||
|
|
||
|
<pre>
|
||
|
<strong>Input:</strong> nums = [1,3,6,10,12,15]
|
||
|
<strong>Output:</strong> 9
|
||
|
<strong>Explanation:</strong> 6 and 12 are even numbers that are divisible by 3. (6 + 12) / 2 = 9.
|
||
|
</pre>
|
||
|
|
||
|
<p><strong class="example">Example 2:</strong></p>
|
||
|
|
||
|
<pre>
|
||
|
<strong>Input:</strong> nums = [1,2,4,7,10]
|
||
|
<strong>Output:</strong> 0
|
||
|
<strong>Explanation:</strong> There is no single number that satisfies the requirement, so return 0.
|
||
|
</pre>
|
||
|
|
||
|
<p> </p>
|
||
|
<p><strong>Constraints:</strong></p>
|
||
|
|
||
|
<ul>
|
||
|
<li><code>1 <= nums.length <= 1000</code></li>
|
||
|
<li><code>1 <= nums[i] <= 1000</code></li>
|
||
|
</ul>
|