1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/倍数求和 [sum-multiples].html

36 lines
1.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个正整数 <code>n</code> ,请你计算在 <code>[1n]</code> 范围内能被 <code>3</code><code>5</code><code>7</code> 整除的所有整数之和。</p>
<p>返回一个整数,用于表示给定范围内所有满足约束条件的数字之和。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>n = 7
<strong>输出:</strong>21
<strong>解释:</strong><code>[1, 7]</code> 范围内能被 <code>3</code><code>5</code><code>7</code> 整除的所有整数分别是 <code>3</code><code>5</code><code>6</code><code>7</code> 。数字之和为 <code>21</code>
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>n = 10
<strong>输出:</strong>40
<strong>解释:</strong><code>[1, 10]</code> 范围内能被 <code>3</code><code>5</code><code>7</code> 整除的所有整数分别是 <code>3</code><code>5</code><code>6</code><code>7</code><code>9</code><code>10</code> 。数字之和为 <code>40</code>
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>n = 9
<strong>输出:</strong>30
<strong>解释:</strong><code>[1, 9]</code> 范围内能被 <code>3</code><code>5</code><code>7</code> 整除的所有整数分别是 <code>3</code><code>5</code><code>6</code><code>7</code><code>9</code> 。数字之和为 <code>30</code>
</pre>
<p><strong>提示:</strong></p>
<ul>
<li>1 &lt;= n &lt;= 10<sup>3</sup></li>
</ul>