1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/计算力扣银行的钱 [calculate-money-in-leetcode-bank].html
2022-03-29 12:43:11 +08:00

37 lines
1.2 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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>Hercy 想要为购买第一辆车存钱。他 <strong>每天</strong> 都往力扣银行里存钱。</p>
<p>最开始,他在周一的时候存入 <code>1</code> 块钱。从周二到周日,他每天都比前一天多存入 <code>1</code> 块钱。在接下来每一个周一,他都会比 <strong>前一个周一</strong> 多存入 <code>1</code> 块钱。<span style=""> </span></p>
<p>给你 <code>n</code> ,请你返回在第 <code>n</code> 天结束的时候他在力扣银行总共存了多少块钱。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre><b>输入:</b>n = 4
<b>输出:</b>10
<b>解释:</b>第 4 天后,总额为 1 + 2 + 3 + 4 = 10 。
</pre>
<p><strong>示例 2</strong></p>
<pre><b>输入:</b>n = 10
<b>输出:</b>37
<b>解释:</b>第 10 天后,总额为 (1 + 2 + 3 + 4 + 5 + 6 + 7) + (2 + 3 + 4) = 37 。注意到第二个星期一Hercy 存入 2 块钱。
</pre>
<p><strong>示例 3</strong></p>
<pre><b>输入:</b>n = 20
<b>输出:</b>96
<b>解释:</b>第 20 天后,总额为 (1 + 2 + 3 + 4 + 5 + 6 + 7) + (2 + 3 + 4 + 5 + 6 + 7 + 8) + (3 + 4 + 5 + 6 + 7 + 8) = 96 。
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 1000</code></li>
</ul>